The Supreme Court has been asked to decide whether the Constitution permits a state to execute a convict who commits murder while serving a life sentence.

The case involves Theodore Moody, one of five Black Muslims convicted four years ago in the slaughter of seven Hanafi (Orthodox) Muslims-including four infants and a 10-year-old child-at Hanafi headquarters and home here in January 1973.

Terming the crime "a holocaust," D. C. Superior Court Judge Leonard Braman sentenced Moody to seven consecutive terms of 20 years to life in a federal maximum security prison. The District of Columbia Court of Appeals is now considering Moody's appeal.

Before the trial, Moody has been held in Holmesburg Prison in Philadelphia on 11 charges of aggravated robbery, burglary and rape-offenses unrelated to the Hanafi slaughter. After his conviction here, authorities returned him to Holmesburg for eventual trial (and conviction) on the Philadelphia charges.

Moody was kept in a maximum security area in Holmesburg. His cellmate was James H. Price, who had been among those indicted in the Hanafi case, and who had consented to testify before the District of Columbia grand jury that investigated the murders.

On Dec. 29, 1974, 5 1/2 months after Moody's return to Holmesburg, Price was found dead in an unoccupied cell. He had been tortured, strangled, and left hanging from a heating vent.

Charged with this murder, and convicted in July 1975, were Moody, John Griffin, also convicted with him in the Hanafi murders, and a third man.

Moody was sentenced to death under a Pennsylvania law that is at the heart of the question before the Supreme Court.

The law allows imposition of the death penalty for premeditated and intentional murder only if a jury determines that there had existed at least one of nine specified aggravating circumstances. One of the circumstances is commission of the crime by a person under a life sentence; another is the use of torture.

Even if all nine aggravating circumstances are found to have existed, however, the sentence must be life imprisonment if the jury finds even one of three specified mitigating circumstances. One of these was, "The age, lack of maturity, or youth of the defendant at the time of the killing."

Moody was 21 when Price was killed. His mother testified that he was "easily led" and "not quite mature." But the jury found no mitigating circumstances and condemned Moody to death.

Last November, a divided Pennsylvania Supreme Court overturned the death sentence, ruling that the state law's restriction of mitigating factors is unconstitutionally severe. For example, the majority said, the "absence of a prior criminal record or even positive achievements or good works" is not among the mitigating factors.

The case also involves a 1976 U. S. Supreme Court decision in which a plurality of the justices expressly reserved judgment on the question of whether a state may make capital punishment mandatory for certain crimes committed by convicts already in prison for life.

The pennsylvania court emphasized that the death penalty imposed on Moody was not mandatory. But in a petition for U. S. Supreme Court review of the Moody ruling, the state said that this "quite simply misses the point," in part because the mitigating circumstances in the Pennsylvania law "are far broader than the Constitution requires."

The pennsylvania judges noted that the seven life sentences had been imposed not in their state, but in the District of Columbia. The state termed this irrelevant to its right to impose the death sentence on Moody.