The Rhode Island Supreme Court yesterday overturned the convictions of socialite Claus von Bulow on charges of trying twice to kill his heiress wife by injecting her with insulin at their mansion in Newport.

In a unanimous ruling, the court ordered a new trial on grounds that prosecutors violated von Bulow's constitutional rights in the way they used evidence gathered by private investigators, who were hired by von Bulow's stepson, Alexander von Auersperg.

The ruling comes more than two years after von Bulow's 1982 conviction on two counts of attempted murder in a trial that attracted worldwide attention because of his jet-set image and the social prominence of his wife, Martha (Sunny) von Bulow, heiress to a Pittsburgh utility fortune.

The jury found that von Bulow secretly injected his wife with insulin to aggravate her low blood sugar in 1979 and again in 1980. She recovered from the first alleged injection, but has remained in a coma since 1980 with what doctors call little chance of recovery.

The court ruled that prosecutors erred in failing to obtain a warrant before analyzing what became key evidence in the case: the contents of a black shaving kit found locked in von Bulow's closet in Newport shortly after the second alleged injection, in December, 1980.

The bag, seized by von Auersperg and a private investigator, contained drugs and a syringe allegedly tainted with insulin, and was turned over to state police.

The court said that the failure of law enforcement authorities to obtain a warrant before testing the drugs violated von Bulow's privacy and his right to protection from illegal searches and seizure.

The court also ruled that the trial judge erred in not allowing von Bulow access to information gathered by Richard Kuh, a former district attorney in New York City who ran the private investigation for von Auersperg.

The state used much of the information in building its case against von Bulow.

"This selective use of allegedly privileged material cannot be said to have promoted the interests of society or defendant in reaching a fair or accurate resolution of the question of guilt or innocence," the court said.

From his Fifth Avenue apartment overlooking Central Park in New York City, von Bulow released a statement through his lawyers saying he is "pleased and relieved that the court has . . . given him an opportunity to establish his innocence."

"The message of this whole case is that rich families shouldn't go around using private prosecutors and private policemen," said Alan Dershowitz, a Harvard Law School professor who represented von Bulow in his appeal. ". . . Vague and circumstantial evidence used to convict von Bulow was improperly handled and withheld by those who had a motive to frame him, and then illegally seized by the state."

Rhode Island Attorney General Dennis J. Roberts II called the decision an "injustice."

He said he has not decided whether to appeal it to the U.S. Supreme Court, which recently has narrowed the scope of the so-called exclusionary rule preventing the admission in court of evidence that was gathered improperly.

Yesterday's ruling cited the state constitution in what Roberts called "its extremely strict application of the exclusionary rule."

Prosecutors said they are not sure whether the ruling has put crucial evidence beyond their reach.

Prosecutors argued that von Bulow wanted to kill his wife to inherit a $14 million share of her fortune and be free to marry his lover, a former soap opera actress.

Defense lawyers portrayed Mrs. von Bulow as self-destructive and given to alcohol and rich foods, which aggravated her chronic low blood sugar.