PRAGUE, Czechoslovakia (AP) _ Czechoslovakia on Wednesday accused two British military attaches of spying and ordered them expelled. Britain said the move was in retaliation for London's expulsion of three Czechoslovak diplomats last week.

The official news agency CTK said Britain's most senior diplomat in Prague, charge d'affaires John MacGregor, was summoned to the Czechoslovak Foreign Ministry and told that Wing Commander John Maynard and Warrant Officer Graham Addy had 14 days to leave the country.

Both men were guilty of ''activity incompatible with their diplomatic status,'' CTK said, using a phrase that in diplomatic parlance means espionage.

On Sept. 22, Britain accused three diplomats at Prague's embassy in London of spying and gave them 14 days to leave.

The three are Czechoslovakia's assistant military attache, Maj. Bedrich Kramar, air attache Maj. Vlastimil Netolicky and Pavel Moudry, a member of the commercial section.

In London, a Foreign Office spokesman denied that the Britons ordered out of Czechoslovakia were spies. He said the move was ''definitely a retaliation'' for Britain's expulsion orders.

''We have said we want to develop relations with Czechoslovakia, but the action of the three diplomats in London didn't help and this does not help either,'' the spokesman told The Associated Press. He spoke on condition of anonymity.

''They (the Czechoslovakian authorities) gave us the usual thing that these men were involved in the gathering of information of an intelligence nature,'' said the spokesman.

He said Maynard, 54, has been posted in Prague since May 1986 and Addy, 36, since June 1986. Both men are married and each has three children.

As Britain did last week, Czechoslovakia emphasized that it wanted to build better bilateral relations but said the alleged espionage ''is an obstacle,'' according to CTK.

Wednesday's expulsions brought to seven the number of Czechoslovak diplomats that Britain has ordered out since 1983. Two were expelled in 1983 and two more in 1984. That year, Czecholsovakia expelled two Britons in an apparent reprisal.