The U.S. Court of Appeals ruled here yesterday that a lower court judge improperly made public some 23,000 documents last fall that the federal government had seized from the Church of Scientology in a criminal investigation.

Although the documents have been available to the public in court files for the last nine months and widely read and publicized, the 2-to-1 appelate court ruling yesterday again makes them secret. The court acknowledged the apparent irony of that situation, but said it felt the renewed secrecy was needed so as not to "compound the errors we perceive in the [lower] court's original orders."

The 70-page opinion, written by U.S Circuit Judge Patricia Wald, is the latest of several court actions in what the appelate court itself referred to as the "tortuous proceedings" surrounding the government's criminal prosecution of the Church of Scientology on charges of wiretapping, burglary and infiltration of government offices.

Nine high-ranking officials of the church, including the wife of its founder, were convicted last fall by U.S. District Judge Charles R. Richey. Two others are awaiting trial before another judge, and the government and the church have been locked in bitter clashes concerning the legality of the church searches and other aspects of the case.

Yesterday's opinion focuses only on Richey's decision last October to release to the public various documents that had been presented to him in a hearing on the legality of a search warrant of the church's headquarters in Los Angeles on July 8, 1977.

Richey said the documents, which included information about alleged plots by the church against politicians, authors and others critical of the church, should be made available to the public because "there is a right in the public to know what occurs before the court" and "sunshine is the best disinfectant."

The defendants in the criminal case objected, and the Church of Scientology (which was not a defendant) also tried to intervene in the case to object. Richey ruled against both groups, and reporters and others -- including several Scientologist -- read through the documents for several days in a special room in the courthouse.

Both groups argued before Richey and on appeal that the only reason the documents had been presented at the hearing on the search was in an attempt to show that the search was unlawful.They never agreed that any documents would be made public except 400 upon which the government specifically relied to get convictions, they added.

The appellate court ruled yesterday, however, that the church had a right to intervene in the criminal proceedings before Richey because, among other reasons, the material had been taken from its property.

Wald, writing for herself and U.S. Circuit Judge Spottswood Robinson III, said they agreed with Richey that the public generally has access to records of a judicial proceeding. However, they added that there are exceptions to that general right of access and said Richey did not give enough explanation of why he felt these particular documents should be made public.

". . .We think the unsealing decision [by Richey] was an abuse of discretion," Wald said. "Under all of these circumstances we conclude that the purposes of public access are only modestly served by the trial judge's unsealing decision."

They said it was clear that the only purpose of the documents' being shown to the judge was for his use in determining the legality of the search and that the judge was well aware that his ruling upholding the search would be appealed.

"The possibility of reversal on appeal contributes to the irony inherent in the decision to unseal the documents at issue," Wald added.

U.S. Circuit Judge George MacKinnon strongly dissented, saying the public would not have had any way of determining the basis of Richey's ruling in the case if he had not made the records public.

". . . The Church of Scientology wants secrecy, not privacy," MacKinnon said. "Judicial proceedings are not secret in our society."