H. Ralph Miller, 55, a judge of the Montgomery County District Court who was highly regarded by his colleagues and members of the bar for his knowledge of the law and his skill in conducting trials, died Monday at Holy Cross Hospital in Silver Spring following a heart attack.

Judge Miller began his career on the bench in 1962 as a judge of the old People's Court in Montgomery County, which was responsible for misdemeanors, traffic offenses and some civil matters. In 1969, he was appointed a judge of the Montgomery Country Circuit Court, a trial court with general jurisdiction. A year later, he was elected to a 15-year term on that court.

As a judge on the People's Court, now the Montgomery County District Court, and on the Circuit Court, Judge Miller gained a reputation for competence and fairness. In 1968, he ruled that a Rockville man who had been arrested 268 times for public drunkeness must be treated as a person suffering from a disease -- chronic alcoholism -- rather than as someone who should be jailed.

In doing so, he acted in a situation in which another local judge said he had not read a major opinion handed down by a U.s. court of appeals that said that alcoholism is a medical rather a police matter. Judge Miller's ruling was part of a continuing -- and ultimately successful -- effort on his part to change the way in which the law in Maryland responded to the problem of excessive drinking.

In 1971, Judge Miller and Judge Robert B. Watts of the Baltimore Supreme Court Bench handed down an 81-page opinion in which they said that the rights of prisoners were being ignored at the Patuxent Institution, one of Maryland's prisons. In 1977, he found that the Montgomery County Board of Education has acted in "bad faith" three years earlier when it ended a policy of employing some teachers and administrators for 12 months of the year and others for only 10 months. The case involved 1,800 of the county's 7,000 teachers.

Although he had diabetes, Judge Miller continued his work in court until his death.

Judge Miller was born in Kokomo, Ind., the son, the grandson and the great-grandson of attorneys. His family moved to Takoma Park when he was 5 and he grew up there. He was a graduate of Roosevelt High School and earned his bachelor's and law degrees at George Washington University.

In 1949, he and one of his brothers, James Robert Miller, set up a general law practice in Silver Spring.They were joined shortly by another brother, William C. Miller, now a judge of the Montgomery County District Court. The firm was known as Miller, Miller & Miller. Ralph Miller remained with the firm until he went on the bench.

In addition to James Robert, of Rockville, and Judge William C., of Silver Spring, Judge Miller is survived by his wife, Ruth S., of Silver Spring; one son, James Spencer Miller, a graduate student at St. Louis University in St. Louis, Mo.; a daughter, Robin Marie Miller, of Silver Spring, and his parents, Homer R. and Mary Jane Miller, of Garrett Park.

The family suggests that expressions of sympathy be in the form of contributions to the Wilmer Opthalmological Institute, Johns Hopkins Hospital, Baltimore, Md.