The criminal trial of two journalists and a social worker accused of endangering state security has blown up in the government's face with disclosure that the jury foreman is himself a former military spy who was lobbying his fellow jurors for a conviction before the defense began its case.

From the time the charges were brought, serious papers here questioned whether the case amounted to prior restraint on reporters' freedom to inquire. Now the operation of British justice has been called into question.

The affair is labeled the ABC Trial after the initials of the three defendants: Crisin Aubrey, 32; John Berry, 34, and Duncan Campbell, 25. After 10 days of prosecution evidence, the judge was forced to call a mistrial because the foreman's post as a commando and spy became public.

Now the judge, himself a former army officer, has suffered a stroke. The government may decide to drop the charges and forget the whole business.

The alleged crime took place on the night of Feb. 18, 1977. Campbell, a writer for the New Statesman, a distinguished socialist weekly, and Aubrey, a writer for Time Out, an entertainment guide that also runs radical political articles, interviewed social worker Berry at his North London apartment.

Berry had been in the military's signals intelligence from 1965 to 1970. This is Britain's equivalent of the National Security Agency. Berry told Campbell, a physicist and specialist in electronic eavesdropping, how Britain monitors radios and telephones around the world. Campbell already had made a reputation here writing about the secret military electronic network that has its headquarters at Cheltenham in south central England.

As the writers left Berry's apartment, with a tape recording of the interview, they were arrested by Special Branch detectives, Scotland Yard's political police.

The three were charged under Britain's 1911 Official Secrets Act.The act's Section One aims at genuine spies and provides up to 14 years for giving or receiving any information that is even "indirectly useful to an enemy." Section Two of the law is the one that has brought the most criticism. It can jail a civil servant who gives or a journalist who receives literally any piece of unpublished government information.

The three defendants were charged with violating both sections of the act, Berry for giving information, Campbell for receiving it and Aubrey for setting up their date.

This led the Economist magazine to observe that the case would "make American journalists' noses twitch with surprise." It amounts, the weekly said, "to what Americans would complain of as, at least, prior restraint and infringement of the First Amendment."

Before the ABC trial began, Campbell and the others were approached by the government with an offer: plead guilty to the lesser charge in Section Two and we will drop the charges under Section One with their 14-year penalties. But the defendants spurned the offer.

Much of their defense is based on masses of documents to show that virtually everything Berry told them had already appeared in print. But this strategy was partly foiled by the government's insistence that most of the trial must be held in secret. This led to testimony in which a major was prohibited from describing in open court the mission of 9 Signals Regiment in eastern Cyprus. The next morning, The Guardian recalled that its defense correspondent had said in print four years ago that the regiment is "a key listening and surveillance post" for British and NATO intelligence.

These events were overshadowed 10 days ago when the defense belatedly discovered that the juror, who had volunteered to serve as foreman, was himself an ex-paratrooper of the Special Air Services, or SAS. SAS is Britain's department of military dirty tricks, carrying out undercover work in Ulster and elsewhere around the globe.

The defense moved to excuse the foreman, Leslie Blackburn, from the jury. But Judge Sir John Willis refused the application and urged the handful of reporters present to use "discretion" in reporting the incident.

For a few days, Blackburn's role was kept secret, but Christopher Hitchens, a New Statesman colleague of Campbell's told the story on a television program a week ago. That outraged Wills, who declared a mistrial, asked the public prosecutor to see whether Hitchens should be prosecuted for contempt, and suffered his attack.

The New Statesman then interviewed ex-jurors in the ABC trial who quoted the foreman as saying that Berry "should have a military trial - straight in, 14 years, straight out."

As for Campbell, since he had not interviewed Berry for money, he must have been planning "to pass it on to somebody," the foreman was quoted as saying.

Blackburn could not be reached for comment. But jurors said, "He never stopped talking about it, even in the corridors and in the canteen during lunch breaks, on and on, trying to convince the other members."

The fact that the government, in a secret application obtained the names and addresses of the 82 potential jurors in the ABC trial six weeks before it began. Under defense questioning, the government acknowledged that all 82 had been examined to insure they were loyal. Thus the government knew from the start of foreman Blackburn's past.