The right of the nation's top law enforcement official to appeal to a pretrial contempt finding survived a supreme court test yesterday.

The justices voted 6 to 3 not to review a ruling made last April in a case involving then-Attorney General Griffin B. Bell, the Socialist Workers Party (SWP), and U.S. District Judge Thomas P. Grisea of New York City.

The SWP, in a 1973 suit still awaiting trial, alleges violations of its constitutional rights in FBI investigations over several decades. The party and other plaintiffs, including the Young Socialist Alliance, seek $40 million in damages.

In pretrial proceedings, the SWP sought from the defendants -- the United States and various federal officials -- the identities of about 1,300 persons who at least twice gave information on the party to the FBI.

"Nothing less than the names of all informants" will suffice, the party said.

In May 1977, Grisea ordered the government to disclose to the plaintiffs' lawyers the names and FBI files of 18 informants selected by the lawyers after examination of the FBI's answers to written questions.

But Bell refused to comply with the order, contending that doing so would severely impair the government's ability to gather information for law enforcement purposes.

The legal issue didn't arise formally until last July, when Grisea, after further proceedings and warnings from the bench, held Bell in civil contempt. Bell appealed.

The central issue was whether the 2nd U.S. Circuit Court of Appeals had grounds for reviewing a pretrial contempt citation that was within Grisea's authority, that raised no novel legal questions and that was important and unusual only because its target was a cabinet officer.

There was no dispute about Bell's right to appeal the contempt ruling after the full case had been tried and decided.

By appealing in the pretrial stage, however, Bell created what Circuit Judge Murray I. Gurfein called "a historic confrontation" between the government and a litigant accusing it of constitutional violations.

Gurfein nullified the contempt order the next day, saying that a contempt finding "should be a last resort, to be undertaken only after all other means to achieve the ends legitimately sought by the court had been exhausted."

The SWP, in a petition for Supreme Court consideration, said that the 2nd Circuit had violated its general policy of avoiding piecemeal review. but Solicitor General Wade H. McCree Jr., seeking to preserve Gurfein's ruling, said that the 2nd Circuit had been unique among the 11 federal appeals courts in barring appeals of a pretrial contempt finding.