A divided federal appeals court yesterday reversed the conviction of former national security adviser John M. Poindexter in the Iran-contra scandal, saying that his rights had been violated by use of tainted testimony.

The 2 to 1 ruling by a panel of the U.S. Court of Appeals for the D.C. Circuit represented another setback for independent counsel Lawrence E. Walsh and his nearly five-year, $28 million investigation of the Iran-contra affair. Nine men have been convicted or entered guilty pleas, but so far no one has gone to jail in the scandal, which involved secret sale of arms to Iran in the mid-1980s and diversion of profits to help the contra rebels in Nicaragua.

Yesterday's decision was similar to the court's 2 to 1 ruling last year overturning the conviction of former national security council aide Oliver L. North. But this time the appellate panel went farther, refusing to give Walsh the chance he had in North's case to return to the trial judge and attempt to show that the trial testimony was not tainted.

That prompted a strongly worded dissent from Chief Judge Abner J. Mikva, who said that in the North case, "this court changed the standards the special prosecutor had to meet; today, we refuse to let him try to meet them."

Walsh warned Congress in early 1987 that grants of immunity to North and Poindexter would complicate his work and could make successful prosecutions impossible. But House and Senate committees then investigating the Iran-contra affair insisted that getting North's and Poindexter's testimony was essential to their attempts to get to the bottom of the scandal. North eventually won dismissal of all charges against him last September after Walsh was forced to concede the case.

Walsh indicated in a brief statement that he was considering appealing yesterday's ruling to the Supreme Court. "The issues in this case are a lot more clear-cut than they were in North's," mainly because of differences in the way the two trials were conducted, a source close to Walsh's office said.

The special prosecutor is still compiling a final report on the Iran-contra affair and investigating allegations of complicity by CIA and State Department officials in attempts to cover up the scandal. He secured the indictment in September of the former chief of the CIA's clandestine service, Clair E. George.

Just yesterday, North was summoned back before the federal grand jury working under Walsh's direction and spent most of the day there, presumably fielding questions stemming from his new book about Iran-contra titled "Under Fire" and subsequent interviews he has given to promote it. Some of North's recent public statements, sources say, disclosed details of which Walsh had not been aware.

But each new prosecution poses difficulties because of the classified government documents needed for trial. And with each setback, Walsh also faces renewed calls from critics in Congress to shut down the inquiry.

Poindexter, a retired Navy rear admiral, was convicted in April 1990 of five felony counts of lying to Congress, destroying official documents and obstructing congressional inquiries into the Iran-contra affair. The highest-ranking Reagan administration official found guilty in the scandal, he was sentenced in June 1990 to six months in jail by U.S. District Court Judge Harold H. Greene, who called him "the decision-making head" of a scheme to deceive Congress in the Iran-contra affair and "invalidate the decisions made by elected officials."

At a news conference following yesterday's ruling, Poindexter said, "We are obviously very pleased with the decision. I have felt all along that I did not commit the crimes that were charged."

At issue in both his legal appeal and North's was whether government witnesses had based any part of their testimony on statements Poindexter or North had made earlier to Congress under grants of immunity from prosecution.

The appellate panel ruled yesterday, as it did in North's case, that any use of such immunized testimony at a later trial violates the constitutional right against self-incrimination. The panel reached that decision even though Greene in Poindexter's 1989 trial, unlike the judge in North's case, conducted extensive pre-trial hearings to make sure that government witnesses were not basing their testimony on the 1987 congressional hearings.

Greene had rejected what he called the "absolutist" view that trial testimony was tainted if a witness so much as had his memory of events refreshed by referring to the congressional testimony. The appeals court yesterday disagreed, saying that Poindexter's rights had been violated when North said at the trial that he could not separate what he knew from personal experience from what he knew by hearing Poindexter testify before Congress.

Greene discredited North's disclaimer, finding that he was lying about his memory out of loyalty to Poindexter, his former boss at the National Security Council.

The appeals court said Greene had used the wrong definition of what constituted a witness's "use" of earlier testimony. Further hearings by the trial court "concerning taint," the majority ruled, would be "pointless."

The ruling was written by appeals court Judge Douglas H. Ginsberg with the concurrence of Judge David B. Sentelle who had authored the court's decision in the North case. Both were appointed to the court by then-President Ronald Reagan. Mikva was an appointee of President Jimmy Carter.

In his dissent, Mikva took exception with the appeals court's refusal to give any credence to Greene's conclusion that North was lying. Under the majority's standard, Mikva said, "as soon as a witness claims to have trouble remembering what he knew before he was exposed to immunized testimony, all of his own testimony is presumptively tainted. . . . The court today tells future defendants that all they need to evade responsibility is a well-timed case of amnesia."

Mikva also took exception to another portion of his colleagues' ruling in which they said Poindexter's conviction on two counts of "corruptly obstructing" a congressional inquiry could not be sustained for the additional reason that the federal statute in question was unconstitutionally vague.

" 'Corruptly influencing' a congressional inquiry does not at all clearly encompass lying to Congress," Ginsberg wrote.

As used in the law, he said, "the term 'corruptly' is too vague to provide constitutionally adequate notice that it prohibits lying to Congress."

Ginsberg noted that another federal statute, which Poindexter was also convicted of violating, barred lying to Congress and sent that portion of the case back to Walsh for further hearings on the tainted testimony issue.

"This strikes me as odd," Mikva wrote of that part of the ruling. The word "corruptly," he added, clearly encompassed what Poindexter told Congress, testimony which Mikva called "a clear violation of his oath of office, his oath to Congress and his duty not to lie."