A 31-year-old Washington man who has U.S. government permission to smoke marijuana for medical purposes was detained for two hours in Boston yesterday after he showed his marijuana cigarettes at a Massachusetts legislative hearing.

The man, Robert C. Randall, won agreement last May from federal drug control authorities to use marijuana in conjunction with three other drugs to help stem the spread of glaucoma, a disease that has damaged both his eyes.

As part of his presentation before a legislative committee on health care in the state capitol, Randall "showed a vial containing several marijuana cigarettes," according to capitol police chief Paul L. Doherty.

After the presentation, William Kearney, supervisory inspector in the drug control unit in the state health department, asked to see the vial, and noted, according to Doherty, that the name of the physician issuing the prescription has been obliterated.

Doherty said Kearney was concerned about possible violation of state and federal law and took Randall to the chief's office where telephone calls were made to Washington.

"As a result," Doherty said in a telephone interview, "I was able to convince the inspector that there was no violation," and Randall was allowed to leave. Doherty said it was learned that the physician's name had been obliterated under a federally sanctioned agreement to keep the doctor's name private.

Doherty said no charges were brought against Randall.

However, Kearney's superior in the health department, Dr. George A. Milchael, expressed concern about Randall's action.

Even if legally permitted to possess marijuana for medical treatment, Michael said, he "shouldn't be in hearing room passing [it] around . . . I'd like to know more about his case."