A sharply divided Supreme Court made imposition of capital punishment harder yesterday by ruling that the states must allow judges to consider as a mitigating factor "any aspect" of a detendant's character or record and any circumstance of his offense that he cities as a basis for mercy.

In lifting the death penalty facing Sandra Lockett, 21, for a killing she neither committed nor intended to commit the court also reprieved 98 of her fellow inmates on Ohio's death row-more than one-fifth of the nation's total of 487.

Additionally, the decision reprieved an uncertain number of convicts on the death rows of other states that, like Ohio limit the range of mitigating circumstances to an extent that it now says in incompatible with the Constitution.

In a related action, the court let stand a ruling overturning the death sentence imposed on Theodore Moody for murdering a fellow convict in a Pennsylvania prison while serving seven consecutive life sentences for the slaughter of seven Hanafi Orthodox, Muslims at their headquarters and home here in January 1973.

Yesterday's decision was the latest in a series that begin in 1972, when the court ruled that death sentences imposed with unfettered discretion violated the prohibition on cruel and unusual punishment in the Eighth Amendment to the Consitution.

To conform to the ruling, numerous states passed laws intended to bring capital punishment within guidelines laid down in multiple opinions by the justices.

In 1976, in upholding death penalty laws newly enacted by Florida, Georgia and Texas, a plurality held that judges must consider the "character and record" and "the circumstances of the particular offense." Some state, including Ohio, Pennsylvania, and Arizona, responded to that decision by enacting laws that limited the mitigating factors and circumstances to be taken into account.

At the same time, the court knocked down mandatory capital punishment laws in Louisiana and North Carolina, resulting in the invalidation of death penalty laws in 19 states. Thirty-three states, including Maryland and Virginia, now have nonmandatory death penalty laws on the books. Rhode Island's law makes death mandatory only for murder committed by a state prisoner.

"The signals from this court have not . . . always been easy to decipher," Chief Justice Warren E. Burger wrote yesterday. "The states now deserve the clearest guidance that the court can provide; we have an obligation to reconcile previously differing views in order to provide that guidance.

But Justice William H. Rehnquist, the dissenter in the 7-to-1 ruling to invalidate the Ohio death statute under which Sandra Lockett was to be executed, wrote that the court now "has gone from pillar to post." The result, he said, is "that the sort of reasonable predictability upon which legislatures, trial courts and appellate courts must of necessity rely has been all but completely sacrified."

Similarly, Justice Byron R. White, while joining in the Lockett judgment joining in the Lockett judgment, wrote that the court "has now completed its about-face" since 1972. He said it did this by holding, "again through a plurality, that the sentencer may constitutionally impose the death penalty only as an exercise of his unguided discretion after being presented with all circumstances which the defendant might believe to be conceivably relevant . . ."

In holding that the sentencing judge cannot be precluded from considering a wide range of mitigating factors, Burger was joined by Justice Potter Stewart, Lewis F. Powell Jr. and John Paul Stevens.

Justice Harry A. Blackmum joined in the judgement, but would have invalidated the Ohio law because it improperly allows capital punishment "for a defendant who only aided and abetted a murder, without permitting any consideration by the sentencing authority of the extent of her involvement, or the degree of her (intent or state of mind), in the commission of the homicide."

White objected more broadly on this issue, saying that the Ohio law violates the Eighth Amendment by permitting a judge to impose the death sentence "without a finding that the defendant possessed a purpose to cause the death of the victim."

Eighteen states allow a judge to consider a minor degree of participation in a homicide, while nine, including Maryland and Virginia, allow consideration of any mitigating factor.

Justice Thurgood Marshall joined in the judgement but renewed his objection to the death penalty as cruel and unusual punishment "under all circumstances." Justice William J. Brennan Jr., who shares Marshall's view, did not participate. He was ill when the case was argued.

The Lockett case involved a felony murder, that is, a murder committed during the commission of another crime-in this case, a robbery in 1975 in Lockett's home city of Akron. The vicitm, pawnbroker Sidney Cohen, was shot to death by one of her accomplices inside the pawnshop while she waited outside.

Prosecutors contended Lockett was the "brains" behind the robbery. They relied heavily on Al Parker, a participant who said that she did not enter the shop because Cohen knew her that no one intended to kill him, and that he was killed when he grabbed the gun in Parker's hand.

Parker guaranteed that he would not be electrocuted by pleading guilty to murder and turning state's evidence. Lockett's brother drew the death sentence. The third participant was spared by a finding that his act was "primarily the product of mental deficiency."

This, along with psychosis, was one of three mitigating factors that prevail under the Ohio law if demonstrated by a preponderance of the evidence. The others are that the victim induced or facilitated the offense, or that it was unlikely it would have been committed but for duress, coercion or strong provocation.

Reports to the trial judge described Lockett as having low average or average intelligence and not being psychotic. The reports also said she had a favorable outlooks for rehabilitation if returned to society, a record of several minor offenses as a juvenile and two as an adult, and a heroin problem that she was conquering.