The Supreme Court agreed yesterday to decide whether a child has a right to adversary hearings when his parents or guardians seek to commit him to a public or private institution for the mentally ill or mentally retarded

The Justices will review a 2-to-1 ruling that a child who is volunteered for commitment is entitled to have two separate hearings before a neutral tribunal, to be represented by an unpaid lawyer or "trained representative" and to confront and examine adverse witnesses.

The purpose of the first hearing would be determined if the child is actually mentally ill or retarded.If so, a second hearing must be held to ascertain if commitment is necessary, if it will be beneficial and if it is the least restrictive alternative available.

The case comes from Pennsylvania, which, like most states, does not require parents to endure what it calls "the intrusion and trauma of adversarial proceedings."

In the term starting in October, the court will hear argument in both the Pennsylvania case and in a similar one from Georgia involving voluntary parental commitment of children to institutions for the mentally ill, not for the retarded. The court accepted the Georgia case for review in May 1977.

In the Pennsylvania case, a panel of three federal judges initially, in 1975, invalidated a state mental-health law on the ground that it impermissibly let parents waive the due process of law guaranteed to their children by the Constitution.

The state sought review of the decision by the Supreme Court, but it sent the case back in May 1977 for a determination whether claims by institutionalized children of deprivation of rights had been mooted by the enactment of a new law that abolished parental commitment of children over 14.

Last May 25, the same panel ruled that the new law also denies due process, laid down procedures for adversary hearings and ordered that the thousands of Pennsylvania children currently confined in hundreds of facilities either be discharged or, within 180 days, be readmitted under those procedures.

In the opinion for the panel, Judge Daniel H. Huyett III cited three main reasons for the ruling:

The great stigma imposed by commitment to an institution.

The possibility of error in diagnosing or identifying mental illness or retardation ("A child who lacks normal motor or speech capabilities, who is unable to communicate or behave like other children, may be mistakenly identified as being retarded," Huyett wrote).

". . . Conflicts between the concerns and interests of the parents and the best interests of the child frequently arise with respect to both mentally ill and mentally retarded children."

Huyett cited testimony by experts that parents often commit mentally ill children because of their inability to cope with the child's problems and "lack of awareness of alternatives to institutionalization."

In a petition for Supreme Court review, the state accused the panel of finding an unconstitutional deprivation of children's liberty "where none exists."

The "young and the very young, and the mentally ill and the retarded have once again been lumped together and given the same treatment" by the panel despite "very real differences," the state contended.

The brief also protested that the panel failed to distinguish among public and private facilities, and among facilities that deal only with mildly afflicted youngsters for a short term, and others that provide long-term care for the severely handicapped.

In another action, the Supreme Court agreed to judge the validity of a court order to the Los Angeles County Fire Department to accelerate hiring of blacks and Mexican Americans. The court will consider what proof of bias is needed in numerous lawsuits that are brought under a federal civil rights law.