U.S. District Judge Charles R. Richey yesterday upheld a massive July 1977 FBI search of Church of Scientology offices in Los Angeles, clearing the way for a Sept. 24 criminal trial of nine church leaders and operatives here.

The church had maintained that the search was unconstitutional for a variety of reasons, ranging from the wording of the search warrant to the manner in which it was carried out by FBI agents.

The agents seized thousands of documents in the raids, and many of those later were presented to a federal grand jury that indicted the church members.

Richey's 50-page ruling, following a six-week hearing here and in Los Angeles earlier this summer, rejected practically all of the church's contentions, however.

He cited documents seized in the raid that apparently detailed the church's alleged conspiracy to plant spies in government agencies, steal government documents and electronically bug government meetings.

In addition, he noted that agents seized documents concerning plans by Scientologists to infiltrate newspapers -- specifically, in this instance, two St. Louis, Mo., daily papers -- and private organizations such as the Better Business Bureau.

"The Fourth Amendment [which prohibits illegal searches and seizures] cannot become so inflexible that criminal activity can be completely insulated from our criminal justice system by the talismanic invocation of religion," Richey said in his opinion.

He said that "no one in our civilized society is pleased" by day-long searches of churches by more than 150 FBI agents, but that the government had a "responsibility" to pursue allegations that the church's officials were breaking the law.

"Overall, the FBI agents who executed the warrants at issue in this case performed a very difficult job in a most reasonable manner," Richey said. He said "we can only hope that never again in our history will the government be required to perform such an unseemly task."

The Church of Scientology, however, issued a statement saying the ruling gives the government "a license to steal" and called Rickey's opinion "a devastating blow."

"The Fourth Amendment, which has protected the privacy of citizens for over two hundred years, may not be reduced to meaningless words on a piece of paper unless this ruling is overturned," the Scientologists said in a prepared statement.

Scientology attorney Philip J. Hirschkop said he felt Richey's opinion "twisted the facts very badly," and "shows a conscious decision (by Judge Richey) to find against us on every point." He said he did not know what steps the church would take next, but that Richey's refusal to postpone the trial is "forcing us to trial unprepared."

Earlier yesterday, th Scientologists had asked the U.S. Court of Appeals to order Richey to reconsider previous pretrial rulings he had made in the case. The appellate court had taken no action by late yesterday afternoon.

Richey's opinion is at least the sixth by federal courts concerning the simultaneous searches against the church carried out here and in Los Angeles on July 8, 1977. Only two weeks ago, a federal judge here ruled that the FBI's search of the church's Washington office was unconstitutional, for example. However, no documents seized in that search are being used in the criminal case so that opinion has no direct effect on the criminal trial.

Richey's opinion is the first to arise in the actual criminal case brought by the government against 11 Scientology leaders. Two of those indicted are in England, where extradition proceedings are pending.