The Supreme Court ruled 7 to 2 yesterday that a state cannot conserve its sanitary landfills by reserving them for disposal of its own solid and liquid wastes while making them off-limits for wastes originating elsewhere.

The ruling struck down a New Jersey law prohibiting the importation of wastes mainly from neighboring Pennsylvania and New York, except for garbage for swine.

Several states and municipalities have or are considering similar laws for garbage or for so-called "hazardous wastes" that require special handling, including treated sludge and acidic and corrosive wastes.

The National Solid Waste Management Association, a trade group, termed the decision "a great victory" because it removes a major barrier to "rational" planning to handle solid wastes on a regional basis.

The decision means "that environmental, not political, criteria will be allowed to guide solid-waste management practices in this country," said association spokesman Richard L. Hanneman.

The New Jersey law, enacted in 1974, immediately affected operators of private landfills that had agreements with Philadelphia and several other cities outside the state.

The operators lost a suit in the New Jersey Supreme Court and appealed to the U.S. Supreme Court.

In the opinion for the high court, Justice Potter Stewart said the law violates the Constitution because a state is not free to impede interstate commerce simply because the commerce is in "valueless" wastes.

The state court concluded that the law was designed to protect not the state's economy but its environment, and that its benefits outweighed its "slight" burden on interstate commerce.

Disagreeing, Stewart said the law was an "economic protectionist measure" that "imposes on out-of-state commercial interests the full burden of conserving the state's remaining landfill space."

He also rejected the defense that the measure is a kind of quarantine law. "There has been no claim here that the very movement of waste into or through New Jersey endangers health," he said. The harms caused by wastes arise after disposal, and at that point, he said, "there is no basis to distinguish out-of-state waste from domestic waste."

In the dissenting opinion, Justice William H. Rehnquist, joined by Chief Justice Warren E. Burger, said that even though burdening landfills will inexorably increase "extremely serious" health and safety problems, the court forces New Jersey either to halt all landfill operations or multiply the hazards by accepting wastes from everywhere.