The Supreme Court ruled 7 to 1 yesterday that a state cannot penalize an official of a political party for invoking his constitutionally protected right to refuse to testify against himself or to waive immunity from prosecution based on testimony he might give.

The government's interest in pre-serving public confidence in the integrity of its political process is an inadequate justification for forcing citizens to incriminate themselves, Chief Justice Warren E. Burger wrote in the opinion for the court.

The ruling involved Patrick J. Cunningham, who was chairman of the State Democratic Committee of New York in December, 1975, when a special state grand jury investigating the sale of judgeships subpoenaed him to testify.

Four months later, he refused to sign a form waiving his right under the Fifth and 14th Amendments to be free of compelled self-incrimination.

By doing this, he triggered a provision of the 1949 state election law that automatically removed him from all four of his elected, unsalaried party offices - including the chairmanship of the Bronx County Democratic Executive Committee - and forbade him to hold any party or public office for five years.

Cunningham sued in U.S. District Court. A three-judge panel ruled the provision unconstitional.

In affirming, the Supreme Court said that New York confronted Cunningham with "grave consequences" for refusing to incriminate himself or waive immunity from prosecution.

His party offices carried "substantial prestige and political influence, giving him a powerful voice in recommending or selecting candidates for office and in other political decisions," Burger wrote. "The threatened loss of such widely sought positions, with their power and perqusites, is inherently-coercive."

Cunningham recently resigned as state Democratic chairman but retained his other party offices.

The Chief Justice also cited the "economic coercion" flowing from damage to Cunningham's professional standing as a lawyer and from the five-year ban on holding salaried public offices.

And, said Burger, the provision is unconstitutional for another reason; it forced Cunningham to forfeit his important First Amendment right "to participate in private, voluntary political associations" as the price for exercising his Fifth Amendment right against compelled self-incrimination.

"As an officer in a private political party," Burger said, Cunningham was "in a far different position from a government policy-making official holding office at the pleasure of the President or governor."

The long dissenter, Justice John Paul Stevens, said Cunningham was "a policy-making official occupying a sensitive position in the government of the state of New York" and was constitutionally the same as public officeholders "who are at once asked to serve their country and to respond publicly to any suggestion of wrongdoing that may be advanced by any hostile or curious witness."

That being so, Stevens contended, in giving Cunningham "a choice tween silence and public service," the state was furthering its legitimate interest "not only in preventing actual corruption, but also in avoiding the appearance of corruption . . ."

(Under a highly qualified federal policy intended to prevent obstruction of justice, a government employee who invoked the Fifth Amendment could be fired on a different ground: refusal to cooperate in a law-enforcement proceeding.)

The state contended that to force it "to choose between an accounting from or a prosecution of a party officer" is to put it "in an intolerable position."

Justice William H. Rehnquist did not participate in the case. He was in a hospital when it was argued.

The court took other actions: FOSTER CHILDREN

More than 300,000 children are cared for by foster parents. A recent national study found that 52 per cent of the children stay at least six years in foster care, with 31 per cent staying at least 10 years. In the District of Columbia the average stay is five years.

In New York State, the law authoritizes social-service agencies to take a child from foster parents after giving 10 days' notice and giving them a lawyer a chance, in a conference, to hear the reasons for transfer and to voice objections. Within five days after such a conference, an agency official must make a written decision. If the decision is for removal, the foster parents may appeal for a full administrative hearing, with the result subject to review in the courts. The state and New York City also provide additional recourses.

But the child can be taken from the foster home - where close ties with the parents often develop - before the hearing and judicial review.

In a 2-to-1 ruling, a panel of three federal judges held that before a foster child is "peremptory" transferred, he has a right to a full administrative hearing at which all parties can present relevant information.

Yesterday, the Supreme Court unanimously reversed. Justice William J. Brennan Jr. wrote that the New York procedures are constitutionally adequate in guaranteeing due process to the child.