The U.S. Supreme Court yesterday upheld a District of Columbia law that allows persons found not guilty by reason of insanity to be held in St. Elizabeths Hospital for terms longer than the maximum prison sentences for their alleged crimes.

Prosecutors said the decision established important guidelines both for states reviewing their insanity laws and for Congress, which has several bills pending on proposed changes in federal statutes on the insanity defense.

Principal Assistant U.S. Attorney Joseph E. diGenova said the ruling "closes the loop on one of the major unanswered questions" in insanity law, which was whether the government could confine defendants under a less rigorous standard of proof than is required for civil commitments to institutions.

Justice Lewis F. Powell Jr., writing for the 5-to-4 majority, said persons acquitted by reason of insanity "constitute a special class that should be treated differently" from persons not accused of crimes.

Powell also contrasted commitment to a mental institution with commitment to prison, saying those sent to mental institutions were there not to punish them but to treat their illnesses and protect them and society from their "potential dangerousness."

The decision also upheld a D.C. law which places the burden of proof in these cases not on the government but upon the defendants. The law requires that defendants at trial must show by a "preponderance of the evidence," a minimal standard, that they are insane.

The law says that persons have an automatic right to review of their conditions periodically, but they must then show by that same standard that they are no longer dangerous to themselves or the community.

By contrast, the current federal statute, which is the one under which attempted presidential assassin John W. Hinckley Jr. was tried, says that the government must bear burden of proof to show that a defendant was not insane at the time of the crime.

DiGenova said the decision was "very, very important . . . because we now have a model standard the D.C. law to look to" in considering changes in the insanity defense.

The decision came in a case involving Michael A. Jones, who was committed to St. Elizabeths in 1976 after being found not guilty by reason of insanity on a charge of attempting to steal a coat from a department store.

Although the crime itself is a misdemeanor carrying a maximum one-year jail sentence, Jones has been held in the hospital for more than seven years.

Jones is allowed every six months to request release, but under the law it is up to him to prove that he is no longer insane or dangerous, and so far he has not succeeded in winning freedom.

His attorney, Harry Fulton of the D.C. Public Defender Service (PDS), said he and his client were "disappointed" by the decision. Fulton said he was preparing papers now for another hearing sometime this summer on Jones' condition.

PDS lawyers argued that persons like Jones may not be confined longer than the maximum sentence they would have received if convicted on the criminal charge. Once Jones had spent a year in St. Elizabeths, the government should have had to ask for a civil commitment and bear the burden of proving that Jones was dangerous, the lawyers argued.

Four justices yesterday supported that position. Justice William J. Brennan Jr., joined by Justices Thurgood Marshall and Harry A. Blackmun, said in his dissent that the majority implicitly overruled or ignored prior court decisions and that constitutional due process protections outlined in those decisions require the government to bear the burden of proving insanity and then only for a limited period of confinement, not indefinitely.

In a separate brief dissent, Justice John Paul Stevens said, "I believe this shoplifter was . . . entitled to his freedom after he had been incarcerated . . . for one year."