The Supreme Court yesterday gave prison inmates the right to an impartial hearing before they can be transferred to a mental hospital.

The decision was one in a string of recent victories for prisoners' rights advocates, who are seeking protection against arbitrary punitive measures against inmates by prison authorities.

Larry Jones, who was serving time in a Nebraska penitentiary for robbery, brought yesterday's case. While in solitary confinement, Jones injured himself by setting fire to a mattress. Prison officials, following Nebraska procedure, obtained determinations from two psychiatrists that Jones was mentally ill and moved him to a mental hospital.

The court majority said that Nebraska's procedure, which in fact is more complete than that in most states, is insufficient.

The court ruled 5 to 4 that prisoners should be given advance notice of such a transfer and an opportunity to contest it at a hearing presided over by an independent "decisionmaker."

In addition, the inmate is entitled to "competent help" in preparing his case.

Four justices in the majority -- Byron White, William J. Brennan Jr., Thurgood Marshall and John Paul Stevens -- thought the government should provide lawyers for poor prisoners at these hearings.

But Lewis F. Powell, who agreed on everything else, dissented on this issue.

"We have recognized that for the ordinary citizen, a commitment to a mental hospital produces 'a massive curtailment of liberty'" that requires the safeguards of due process, White wrote for the majority.

Transfer of an inmate to a mental hospital goes beyond the sentence imposed, and labels the prisoner with the "stigma" of mental disease White wrote.

In judging similar cases in the past, the court has said that due process is required for deprivation of any important privilege originally promised the prisoner. If an inmate is told that the privilege will be revoked if he misbehaves, the court has ruled, he must have the opportunity to dispute allegations of misbehavior.

The Supreme Court has already applied that standard to parole, "goodtime" sentence reductions and solitary confinement. Yesterday it applied it to the transfers. A prisoner led to believe he will remain in the prison if he follows the rules must have the opportunity to dispute any allegation that he broke them, the court said.

Chief Justice Warren E. Burger and Justices William H. Rehnquist, Potter Stewart and Harry Blackmun dissented from the opinion.

In another decision, the justices reversed a D.C. Court of Appeals opinion in the case of Keith Crews.

The appeals court had thrown out Crews' 1974 conviction on charges of assaulting a woman in a restroom at the Washington Monument because he had been illegally detained by Park Police.

The appeals court said that a photograph of Crews obtained by police during the detention was used to help the victim identify Crews.

The Supreme Court ruled yesterday that the victim, having provided a description that fit Crews before viewing the photograph, could have identified him in court without benefit of the improperly obtained picture. For this reason, the conviction must stand, the justices said.