The Supreme Court ruled yesterday that states may tap the assets of bankrupt polluters to clean up the mess left behind. The high court acted in a pair of cases that could have a major impact on cleanup efforts at hazardous-waste sites.

The 5-to-4 decision, written by Justice Lewis F. Powell Jr., omes as dump owners frequently are filing for bankruptcy in the face of cleanup orders from state authorities. In the two cases before the court, trustees of the bankrupt dumps were abandoning them, ignoring state demands for reimbursement for cleanup costs.

Powell said federal bankruptcy laws do not preempt all state and local laws. "Neither the court nor Congress has granted a trustee in bankruptcy powers that would lend support to a right to abandon property in contravention of state or local laws designed to protect public health and safety," Powell said.

The case dealt with the question of who should pay for cleaning up a dump -- the creditors of the dump operator or the public at large.

Yesterday's decision involved waste-oil recovery facilities in Long Island City, New York and Edgewater, N.J., owned by Quanta Resources Corp. Faced with an order to spend an estimated $6 million to eliminate cancer-causing wastes from a site in New Jersey, Quanta filed for bankruptcy in 1981, a year after it had purchased the facility with a $600,000 loan from Midlantic National Bank.

New Jersey officials wanted the trustee to remove the hazardous wastes from the Edgewater site. New York officials wanted reimbursement from the assets of the company for the $2.5 million spent cleaning up the Queens site.

Powell, writing for the majority, noted the extraordinary health hazards posed by abandoning the toxic wastes in leaking containers at the New York site, saying "a trustee may not abandon property in contravention of a state statute . . . that is reasonably designed to protect the public health or safety from identified hazards."

What will happen to the case in the lower courts is uncertain, observers said yesterday.

One result of the ruling in Midlantic National Bank v. New Jersey Department of Environemental Protection and Thomas J. O'Neill v. Quanta Resources Corp. may be that Midlantic and other creditors will lose all or a good portion of their investment.

If that were to happen, then the "paradoxical" result may be that the ruling could cause banks to stop giving credit to waste operators, leaving the states to foot cleanup bills in the long run, said University of Chicago Law School Professor Geoffrey P. Miller.

Other observers said the ruling only insured that some attention would be given to environmental interests during the bankruptcy proceedings, but did not require that the states would receive the entire estate for the cleanup.

Justice William H. Rehnquist, joined by Chief Justice Warren E. Burger and Justices Byron R. White and Sandra Day O'Connor, dissented, saying the exception to a trustee's power to abandon worthless property was not needed to protect the public in these cases.