The Supreme Court ruled yesterday that defendants may refuse to submit to psychiatric examinations that could be used to sentence them to death.

The court also said that defendants must be told they have a right to consult a lawyer before deciding whether to take such an exam.

The opinion removes from Texas' death row up to 70 inmates sentenced to die largely on the basis of court-ordered interviews they gave to a psychiatrist. Unaware of the true purpose of the interview, some defendants provided incriminating information to the psychiatrist, who could then use it to convince a sentencing jury that the man would always be dangerous and should be executed.

The court said that defendants subject to the death penalty, when being questioned by a psychiatrist, need protections similar to those they enjoy when being interrogated by police: the right to remain silent, the right to consult a lawyer and the right to be informed of both protections.

The ruling resolved one of the most vigorous debated in years about the uses of psychiatry in the criminal justic system and the ethics of psychiatrists as "expert witness." The American Psychiatric Association had condemned the technique as medically and ethically unsound because of the unreliability of predictions of future dangerousness.

The NAACP Legal Defense Fund, which brought yesterday's case, said it breached a defendant's constitutional protection against self-incrimination and denied the right to counsel.

Texas officials defended their practice as a legitimate part of the adversary system. Defendants were free to employ their own psychiatrists to rebut the damaging testimony, the stage argued.

Most of the Texas death row inmated affected by yesterday's ruling were examined by a single psychiatrist, Dr. James Grigson, of Dallas. The defendant in yesterday's case, Ernest Benjamin Smith, was one of them.

Smith was examined by Grigson before his trial on charges of participating in an armed holdup in 1973 that took the life of a Dallas storekeeper. Smith was given no choice about whether to talk with Grigson, no lawyer to advise him about the interview and no indication of the purpose of the interview. During the 90-minute session, Grigson later testified, Smith showed "no remorse" for his participatgion in the crime.

Smith was convicted. Then a separate trial, as is required in death penalty cases, began with Grigson as the prosecution's sole witness. Grigson said that Smith's lack of remorse, among other factors, showed him to be a "severe sociopath" who would undoubtedly commit similar crimes is allowed to live.

It was roughly the same testimony and the same language. Grigson used in dozens of other death penalty cases.

Chief Justice Warren E. Burger wrote yesterday's opinion. The court was unanimous in erasing Smith's death sentence. Five justices agreed with Burger on the new safeguards for defendants while three, Justices Potter Stewart, Lewis F. Powell Jr. and William H. Rehniquist, thought a narrower ruling was adequate.

Burger said most of the protections for defendants established in the court's 1966 Miranda ruling apply with no less force to a defendant during a death penalty trial.

Statements to the psychiatrist must be given "freely and voluntarily without any compelling influences,'" Burger said quoting the ruling in Miranda v. Arizona . Otherwise, the statements amount to compelled self-incrimination, prohibited by the Fifth Amendment.

The decision whether to talk to the psychiatrist is a life and death decision, Burger continued, for which a layman is entitled to legal counsel. "It follows logically from our precedents that a defendant should not be forced to resolve such an important issue without the 'guiding hand'" of a lawyer, he said.

The court carefully execpted from the ruling psychiatric examinations related to a defendant's insanity plea or to competence to stand trial. In those situations, where the defendant raises the psychiatric issue, the state is entitled to gather its own psychiatric evidence to conduct its case, the court said.

In other action yesterday:

The court, throwing out a Nebraska prison inmate's previously successful civil rights claim for $23, struck a compromise between the desire of the states to be rid of such small civil rights suits and the needs of prisoners and others to be protected by federal law.

The inmate sued after prison officials lost or misplaced a mail order hobby kit, he had ordered. The lower court said he had been deprived of due process and could collect damages under the Civil Rights Act of 1871 and its much-used Section 1983, which allows suits for damages for such deprivations.

The court held yesterday that the inmate had not been deprived of due process because state laws in Nebraska could be used and should have been used to recover his claimed damages.

The court also strengthened the protections for criminal suspects against interrogation by police outside the presence of a lawyer. Ruling in Edwards v. Arizona yesterday, the court said that a defendant need say only once that he desires a lawyer. After that, police may not make efforts to get him to talk without his lawyer.

The case stemmed from police interrogation of Robert Edwards, charged in 1976 with robbery, burglary and murder in Arizona. After his arrest, Edwards told police he wanted an attorney "before making a deal." Police stopped questioning him that evening.

But the next morning, detectives showed up at the jail and started questioning Edwards again. Edwards talked, implicating himself in the crime. Justice Byron R. White, writing for the majority, reversed Edwards' conviction yesterday, saying police never should have instigated the second interrogation once they were told of his desire for a lawyer.