The U.S. Court of Appeals ruled here yesterday that, under certain circumstances, federal prosecutors can be sued by private citizens for alleged misconduct in the courtroom.

The 2-to-1 decision came in a case involving a crusading prosecutor assigned to ferreting out antiwar figures and investigating their activities. In one such case in Florida, it is alleged, he lied to a judge who had posed a single question to him.

The ruling, the second in a week by the appellate court here concerning the rights of private citizens to sue government officials, strikes down a long-standing legal doctrine that gave prosecutors immunity from lawsuit for their actions in investigating and prosecuting criminal offenses.

Such an immunity had been deemed required, according to numerous legal observers and the dissenting judge yesterday, to protect prosecutors from harassing lawsuits brought by their investigating targets.

Yesterday's ruling came in a case involving Guy Goodwin, the circuit-riding prosecutor who headed a Justice Department unit created by the Nixon administration to prosecute crimes by "revolutionary terrorists" in the late 1960s and early 1970s.

Although grand juries across the country directed by Goodwin returned scores of indictments against antiwar activists, only a handful of defendants ever were convicted. Judges and juries either acquitted the defendants or dismissed the charges, often after hearing allegations of governmental misconduct - such as the alleged use of agents provocateurs - during the investigations.

Goodwin was directing an investigation into the Vietnam Veterans Against the War and their alleged plans to disrupt the Republican National Convention in 1972 in Florida when the events occured that resulted in yesterday's ruling.

During the grand jury phase of that investigation, Goodwin was placed under oath in a court hearing and asked if there were any government informants among a group of VVAW members who were then fighting their subpoenas before the grand jury.

Goodwin answered, "No, your honor," and stepped down from the witness stand.

Eight VVAW members eventually were indicated and brought to trial in August 1973. At that trial, one of the same group of members about whom Goodwin had testified the previous summer showed up as a government informant and was allowed to testify against his former companions.

The eight defendants at the trial were acquitted by the jury after three hours of deliberations. However, they later filed a civil lawsuit against Goodwin and other federal investigators in the case, contending that their constitutional rights had been violated because of Goodwin's alleged false statement under oath.

The Justice Department urged U.S. District Judge Aubrey E. Robinson Jr. to dismiss the case on the ground that Goodwin was cloaked with the absolute-immunity doctrine available to federal prosecutors at all steps of their work.

Robinson refused, saying that if Goodwin had committed perjury, it was outside his office duties and he therefore could be sued.

The Justice Department then took an immediate appeal on that issue to the three-judge panel of the appellate court that issued yesterday's ruling affirming Robinson's position.

In saying the suit could continue against Goodwin, the appellate court ruled yesterday that prosecutors are not immune from suit for "any and all measures they may undertake in the course of wide-ranging law enforcement investigations or general fact-finding expeditions."

Although immunity might cover all acts of the prosecutors during the actural trial of a case, the court said in its majority opinion written by U.S. Circuit Judge Carl McGowan, it does not cover the prosecutors at all phases of the investigation that leads to criminal charges.

During the investigative stage, McGowan said, prosecutors enjoy only a qualified immunity such as that available to such other investigators as police officers.

Pointing out that there had been no apparent official investigation into Goodwin's alleged misconduct in the four years since it occured, McGowan said civil lawsyits should be available as restraints on prosecutorial excesses.

Agreeing with McGowan in the majority opinion was U.S. Circuit Judge Spottswood Robinson III.

U.S. Circuit Judge Malcolm R. Wilkey wrote a lengthy and biting dissent in which he accused the majority judges of misconceiving the role of the prosecutor during the investigative stage of criminal cases.

The opinion, Wilkey said, rejects the "time-honored" absolute immunity of prosecutors and clears the way for prosecutors and clears the way for prosecutors to be "effectively subjected to harassing suits, as Goodwin has been here."

Wilkey also said the majority decision "represents a deadly blow at nearly all the common-law recognized quasi-judicial absolute immunities - prosecutors, counsel and witness. Jurors, and then judges, will doubtless be next." The majority asserted, however, that was not the intent of their opinion.

Friday, the U.S. Court of Appeals ruled in a 9-to-0 opinion that federal government officials - particularly in the executive branch - are totally immune from suits for such alleged offenses as libel and slander. That opinion did not deal with prosecutional inmunity.

Yesterday's ruling could be appealed to all nine members of the appellate court here or directly to the U.S. Supreme Court. A Justice Department spokesman said attorneys involved in the case had not yet read it and made any decisions about appeal, and said Goodwin - who is still a prosecutor in the general crimes sections of the Justice Department's criminal division - would have no immediate personal comment.