The Supreme Court, wrapping up its work for the 1987-88 term, Wednesday upheld the constitutionality of the independent counsel law used to investigate, indict and convict key figures in the Reagan administration.

The court, in a 7-1 decision by Chief Justice William Rehnquist, said the special prosecutor law inspired by the Watergate scandal does not violate the Constitution's balance of powers requirements.The ruling, which drew a bitter dissent from Justice Antonin Scalia, lifts a legal cloud that threatened investigations or prosecutions of several Reagan administration officials under the Ethics in Government Act.

Although his investigation was not directly involved in the case before the court, Iran-Contra prosecutor Lawrence Walsh said in a brief statement, "The independent counsel statute provides a workable solution to a difficult problem. We are gratified that the Supreme Court has upheld the constitutionality of that statute."

Alexia Morrison, the independent prosecutor whose case was before the court, was not immediately available for comment. She has been probing whether a top Justice Department official lied to Congress about the 1983 the Environmental Protection Agency scandal.

In another major decision as the justices released the final rulings of the term, a splintered court ruled that sentencing children 15 and younger to death offends "civilized standards of decency," but left it up to states to set a minimum age for handing out capital punishment.

Although four justices said it is unconstitutional to sentence to death children under 16 at the time of the crime, they could not win a fifth vote to make a an absolute majority.

In a pluarlity opinion joined by three justices, Justice John Paul Stevens wrote it violated the Eighth Amendment ban on cruel and unusual punishment to impose a death sentence on anyone under age 16 at the time of the crime.

Justice Sandra Day O'Connor, in a separate opinion, wrote that it was premature for the court to set a minimum death penalty age. But she nonetheless agreed with the plurality that, in the case at hand, the death sentence should be overturned.

Before beginning a summer-long break - until the traditional first Monday in October - the justices also:

-Ruled 5-4 that a federal law that gives religious groups money to counsel teenagers on sex and pregnancy does not violate the First Amendment ban on entangling church and state.

-Ruled 8-0 that employers may be sued under civil rights law for "subjective" employment decisions that tend to favor white workers over minorities.

-Held 6-2 that a sex offender's right to confront witnesses was violated by a barrier used at trial to keep his child victim from seeing him.

In the special prosecutor case, Rehnquist was joined in his ruling by Stevens, O'Connor and Justices William Brennan, Byron White, Thurgood Marshall and Harry Blackmun. Justice Anthony Kennedy, the newest member of the court, took no part in the ruling.

"In sum, we conclude today that it does not violate the `appointments clause' for Congress to vest the apointment of independent counsels in the Special Division; that the powers exercised by the Special Division under the Act do not violate Article III (of the Constitution); and the Act does not violate the separation of powers principle by impermissibly interfering with the functions of the Executive Branch," Rehnquist wrote.

Scalia, in a sharp dissent, attacked the court's ruling as an "ad hoc judgment" and said it was plain to see the law violated the constitutional separation of powers doctrine.