The occasion was oral argument before the Supreme Court on a major death penalty case. Justice William H. Rehnquist, the arch-conservative, asked a lawyer for the state of Oklahoma whether it wouldn't be cheaper "from the taxpayers' point of view" to execute the defendant than to confine him for years of psychiatric treatment.

From the other side of the bench came the familiar growl of Justice Thurgood Marshall, the arch-liberal: "Well," Marshall said sarcastically, "it would be cheaper just to shoot him when you arrested him, wouldn't it?"

Marshall and Rehnquist are in hostile camps at the court, and, during the term that ended Friday, the camps were perhaps as hostile as they've ever been: Marshall and Justices William J. Brennan Jr. and Harry A. Blackmun on one side and on the other, Chief Justice Warren E. Burger and Justices Rehnquist and Sandra D. O'Connor. The three others, Byron R. White, John Paul Stevens and Lewis F. Powell Jr., shifted between the poles, deciding which would prevail.

What the court did this term depended on which coalition seized control. Sometimes, two courts seemed to be at work.

One court broke new ground in federal-state relations by imposing important restrictions on federal court intervention in state criminal proceedings and property tax controversies.

Another court seemed to revive the federal interventionism of the '60s by telling legislatures that they cannot deny a free public education to illegal aliens, and by telling school boards that they risk being hauled into federal court for censoring books in their school libraries.

One side won major victories by ruling that the states must have stronger evidence of abuse or neglect before removing children from parents and that minorities do not need "smoking gun" evidence of voting abuses to prove discrimination.

The other succeeded in giving police nearly blanket authority to search private belongings in automobiles; in awarding absolute immunity from civil damages suits to the president and in telling school systems they do not have to go overboard in providing special schooling for handicapped children.

The votes on many of the major cases were close. That means the decisions are unstable. They may survive a year or a decade, depending on who becomes president and who he appoints to the court.

The court now includes the appointees of six presidents, starting with Dwight D. Eisenhower and excepting Jimmy Carter.

The court comprises a former majority leader of the Arizona Senate (O'Connor); a former president of the Richmond school board (Powell); a one-time leader of the NAACP (Marshall); a former Nixon Justice Department official (Rehnquist); a former political adviser to Harold Stassen (Burger); a former Harvard mathematics major (Blackmun); an antitrust lawyer (Stevens); a Rhodes scholar who played professional football (White); and a former New Jersey superior court judge (Brennan).

The court's record is clear on individual cases, but collectively its record in the difficult cases this term was a smorgasbord guaranteed to give lawyers whatever quote they need for whatever point they're arguing.

Aliens "by definition, are those outside the community," the court said in a case upholding California's exclusion of legal aliens from jobs as probation officers. But when issuing the ruling on illegal aliens and education, the court said, "We cannot ignore the social costs borne by our nation when select groups are denied the means to absorb the values and skills upon which our social order rests."

In a ruling which upheld federal intervention in cases involving termination of parental rights, the justices said, "When the state moves to destroy weakened familial bonds, it must provide the parents with fundamentally fair procedures." But when it resolved a second case by ruling against a federal role, the court said the use of federal habeas corpus intervention "should be reserved for those instances in which the federal interest in individual liberty is so strong that it outweighs federalism and finality concerns."

Extraordinary facts--the heartbreaking plight of the mentally retarded, the sickening crime of exploiting young children in sex films, a blatant abuse of power by the courts of Mississippi--occasionally permitted solid majorities or unanimity on controversial social issues.

In unanimous votes, the court extended constitutional rights to the institutionalized mentally retarded, threw out a damages award against the NAACP for its political boycott in Port Gibson, Miss., and relaxed the First Amendment to allow a broad attack on child pornography.

The split at the court is not new, but O'Connor's arrival seemed to polarize the court further.

She came with her own conservative agenda of judicial restraint, most pronounced in cases involving confrontations between federal and state power. Thus, when the court split on such social issues as defendants' rights, she sided with Burger and Rehnquist most of the time.

Much of her writing struck one note: states' rights.

Federal habeas corpus, which allows judges to review state criminal incarceration at any time, is "federal intrusion," she wrote in one of her opinions restricting it.

Federal court rulings on whether state unemployment taxes may be imposed on religious schools constitutes "federal court interference," she wrote in another case.

A decision striking down Idaho's method of taxing corporations, she said in dissent, "has straitjacketed the states' ability" to develop fair systems of corporate taxation.

The crusade clearly got to the liberal wing of the court. Brennan reached his conclusion early in the term. "The bloom is off the rose," he said as he dissented from one of her rulings, accusing her of straying from an earlier opinion she wrote in Rose vs. Lundy.

By the end of the term, Blackmun, Marshall and Brennan openly accused her of purposely "mischaracterizing" a lower court ruling to reach a desired pro-business result in a sex discrimination case pitting the Ford Motor Co. against the Equal Employment Opportunity Commission.

She, in turn, took them to task, in the genteel fashion of the court, for attacking her character. ". . . . We decline the opportunity to address further this ad hominem personal argument," she responded in a footnote in the same case.

There was one major exception to her efforts on behalf of judicial restraint. She wrote the decision declaring unconstitutional the exclusion of men from the Mississippi University for Women nursing school. Womens' rights activists considered the language of the decision an important reinforcement of the law against sex discrimination.

In other highlights of the court's term, the justices:

* Made it clear in several cases that it disapproves of making one person responsible for the misconduct of others. In two cases involving this concept of "vicarious liability," the court said that contractors in Pennsylvania cannot be punished for job discrimination committed by a union hiring hall and that NAACP protesters in Mississippi cannot be punished for violence not directly tied to them. It also said a criminal cannot be put to death unless he is directly involved in a murder.

* Further carved out a special place in the law for children. In the "kiddie porn case," the illegal aliens case and the federal intervention in child custody case, the court justified its decisions on the grounds that special protections are due the young. Similarly, it permitted prayers on public college campuses but refused to retreat from its ban on prayer in public grade schools, in part because the students there are children.

* Said that fee-splitting arrangements among doctors could be automatic violations of antitrust law and that bar associations could not impose excessive restrictions on the content of lawyer advertising.

* Reaffirmed what had been an uncertain "right of access" to criminal trials, which some observers hope can be expanded into a general right of access to all kinds of governmental activities and proceedings.

* Continued to forge novel concepts of how to interpret the Congress. In a case granting a private right to sue under commodities futures laws, the court said Congress indicated that it approved of such a right by remaining silent in the face of lower court rulings establishing it. Congress would have done something about those rulings if it had disapproved, the court ruled.