A federal judge declared illegal yesterday a major portion of the process by which the Food and Drug Administration determines whether thousands of nonprescription drugs are safe and effective enough to be sold.

The ruling by U.S. District Senior Judge John J. Sirica affects over-the-counter medicines ranging from cold tablets to nasal sprays and antacids to aspirin, but stops short of ordering the FDA to take any drugs off the market.

However, it would require that the FDA no longer allow a drug to be marketed if there was any question about its safety or effectiveness.

The ruling came in a suit that originally was brought by the nonprofit Health Research Group, which had said the method by which the FDA had been reviewing hundreds of thousands of nonprescription drugs for the last 17 years was causing unnecessary risks to consumers.

Under the method, the FDA could classify a drug in Category I, safe and effective, Category II, unsafe and ineffective, and Category III, insufficient evidence to determine whether the drug is safe or not. The drugs in Category III could continue to be marketed as long as the company producing them continued to test them, however.

The suit did not question the Category I or Category II classifications. It claimed, however, and Judge Sirica found, that the Category III system is illegal.

Judge Sirica said that FDA procedure "flies in the face" of the nation's drug laws by allowing questionable drugs to be sold.

The review, which the FDA recently promised to complete within the next five years, is a complex study of the safety and effectiveness of virtually every drug sold over the counter. One preliminary portion of that study reviewed 156,300 products, and 30 percent of them were placed in the Category III slot.

The FDA had claimed that the Category III system made "eminently good sense," since it encourage continued testing of new combinations of drugs.

Sirica said the question before him, though, was not whether the FDA's policy was "wise or reasonable," but whether it was in harmony with the law. He said it was not, since the law required the FDA to ensure that "every marketed drug is both safe and effective."

"To say that the FDA commissioner has the authority [to allow such drugs to be marketed], is nothing less than a frontal assault on the premarket licensing scheme of the Food, Drug and Cosmetic Act," Sirica said in an opinion released late yesterday.

He noted that while he could have ordered the FDA to withdraw every Category III drug from the market, he felt it might be better to use a warning system temporarily for such drugs or for the FDA to revise the system altogether.

The sponsors of the suit had claimed that various name brand over-the-counter drugs designed to treat similar complaints actually contained the same basic safe and effective ingredients. However, they said drug companies experimented with additional ingredients to make their products seem to be something "extra" and that it is these ingredients that are questionable.

They said it was their hope that one result of the suit would be the reformulation of many such drugs with a drop in price and with fewer risks to users.

Dr. Sidney Wolfe, head of the Ralph Nader-backed Health Research Group, said various drug companies had stopped using certain ingredients once they were placed in the Category II status, but would continue to use them if they were placed in Category III.

He said there are hundereds of Category III ingredients that are a "fraud" because of questions about their effectiveness, and that their risks outweigh their possible benefits.

Sirica said at one point in his opinion that he was sympathetic to the plaintiffs' "frustration" with the FDA and its willingness to grant grace periods for drug testing while the products are being marketed.

Robert A. Altman, attoney for the Proprietary Association, a drug company trade group, said the decision would have no effect whatever on the marketing of the products in question.

He reiterated that the judge rejected claims that the products were unsafe or ineffective and declined to restrict or restrain the marketing of the products at this stage.

Marketing Altman said "will continue as before . . ."