The Supreme Court ruled 6 to 3 yesterday that a state can execute an offender under a law enacted after the commission of the crime.

The court held that imposition of the death penalty on a Jacksonville, Fla., man who murdered two of his four children did not deny him that constitutional protection against ex-post facto laws.

Justice William H. Rehnquist wrote in the opinion for the court that "the brutality and heinousness" of the murders and of the torture and abuse of the other two children are "relevant . . . to the trial judge's imposition of the sentence of death" on Ernest John Dobbert Jr.

But dissenting Justice John Paul Stevens wrote, "The atrocious nature of this individual's crimes, which the court recounts in such detail, is of course no more relevant to the legal issue than the fact that 10 of the 12 jurors who heard all of the evidence voted to spare his life."

The decision is the latest in a series on the death penalty since the court ruled five years ago that state capital punishment laws were unconstitutional because they were imposed randomly, executing some persons and imprisoning others.

"Of the hundreds of prisoners on death row at the time," Stevens said, "none was resentened to death" because "our state courts and legislatures uniformly acted on the assumption that none of them could be executed pursuant to a subsequently enacted statute." But under the rationed now adopted by the court there is no such constitutional barrier," he said.

Florida Attorney General Robert L. Shevin told a reporter that the decision affects none of the 86 other persons - including one woman - who were on the state's death row as of the end of May.

The American Civil Liberties Union's Capital Punishment Project said the decision may affect few if any of the 283 other persons now on death row in 17 other states.

Shevin said that "If there were ever a case in which the death penalty was warranted, I believe this is it." He added, "I'm pleased with the victory for the state, because there was a good substantial legal argument on both sides."

The ACLU project's Henry Schwarzschild said that "the law . . . that the Supreme Court made is dubious, the morality of it appalling and the social policy of it outrageous."

Louis O. Frost Jr., attorney for the imprisoned 37-year-old Dobbert, declined to comment now but said he will petition for a rehearing. The court almost never grants such petitions.

Dobbert was convicted of murdering his daughter Kelly Ann, 9, on New Year's Eve, 1971, and his son Ryder Scott, 7, sometime between then and April 8, 1972. Police never have found the bodies. He also was convicted of torturing his son Ernest John III, 11, and of abusing his daughter Honore Elizabeth, 5.

An anonymous tipster told a welfare agency in Jacksonville in January, 1972, that there was evidence of chidl abuse at the Dobbert residence. But an investigation turned up no evidence of it, and the case was closed.

Two months later, Ernest, who had been beaten, was found wandering in the city. He told authorities that his father, in addition to beating him, had beaten Kelly Ann and Ryder to death and had left a battered Honore locked in a closet. The child described Dobbert as a "wonderful father except when mommy's not here."

Police got a warrant for Dobbert's arrest, but he fled before they could serve it. In October, 1973, he was arrested in Texas, extradited, and, in March, 1974, tried and convicted.

The jury's 10-to-2 recommendation for life imprisonment, made because of circumstances the jurors found mitigating, was rejected by Judge Hudson Oliff. Sentencing Dobbert to die, he detailed 13 "unspeakable horrors committed against all of the children over a period of time." The Florida Supreme Court affirmed the sentence and was upheld yesterday.

In the U.S. Supreme Court, a narrow sector of the chronology was the seedbed for the constitutional dispute between the majority and Justice Stevens, who was joined in dissent by Justices William J. Brennan Jr. and Thurgood Marshall.

The murders occurred before the court invalidated state death penalty laws, including Florida's in June, 1972. But the state tried Dobbert under a law it enacted after the murders - in December, 1972.

Under the old law, a jury recommendation for mercy would have bound the judge; under the new one he was free to accept the recommendation or sentence Dobbert to die. Justice Rehnquist found "not compelling" the defense speculation that the jury under the old law would have made a binding recommendation of life imprisonment.

But his major emphasis lay on the point that the new law, which the court upheld as constitutional last July, "affords significantly more safeguards to the defendant than did the old." For example, if a jury recommends mercy, as one did for Dobbert, the judge can overrule it only if the facts arguing for death are, the state high court has said, "so clear and convincing that virtually no reasonable person could differ."

Rehnquist characterized the changes made by the new laws as "procedural and on the whole ameliorative . . ." And, he wrote, "It is axiomatic that for a law to be ex post facto it must be more onerous than the prior law."

He cited a 1937 Supreme Court decision in which he emphasized this sentence: "But the ex post facto clause looks to the standard of punishment rather than to the sentence actually imposed."

From the same decision, Stevens recalled "language that might have been written with the present case in mind: "The Constitution forbids the application of any new punitive measure to a crime already consumated, to the detriment or material disadvantage of the wrongdoer."

Chief Justice Warren E. Burger, in a separate opinion, stressed Rehnquist's contention that the old death penalty law put Dobbert "constructive on notice that this penalty might indeed follow his actions."

Stevens scorned this in his opinion, which expressed the hope that the decision "will ultimately be regarded as nothing more than an archaic gargoyle . . . a demeaning construction of a majestic bulwark in the framework of our Constitution."

How, he asked, could the old law have provided "fair warning" when the court itself, in 1972, said such laws "freakishly imposed" death? Could Dobbert have been "presumed to know that the old Florida statute was a nullity?"

Stevens said that if the ex post facto clause "was intended as a barrier to capricious government action, today's holding is actually perverse."