The medical career of Pinyon L. Cornish, a licensed physician in the District of Columbia since 1929 came to an abrupt end yesterday when he pleaded guilty in federal court to illegally dispensing 100 tablets of the pain-killing drug Dilaudid.

The 77-year-old Cornish, who is in failing health with a heart condition, agreed to surrender his medical license and now faces up to 15 years in prison, a $25,000 fine or both.

Assistant U.S Attorney Joseph F. McSorley told U.S. District Court Judge Oliver Gasch that Cornish had dispensed the drug as part of a wide-rangng scheme in which he wrote prescriptions using the names of dead people as well as some of his living patients, but then apparently sold the prescriptions to drug addicts.

A Drug Enforcement Administration investigation had shown that one D.C. drugstore, the Marco Pharmacy at 908 Kennedy St. NW, had dispensed 31,865 Dilaudid tablets between October 1975 and October 1977, McSorley said. Of that amount, he said, 29,065 had been sold based on 448 prescriptions Cornish had written for 105 patients.

McSorley said that DEA compliance investigators Harold Dieter and Linda Lee had checked with 18 persons whose names appeared on 79 of the Marco Pharmacy prescriptions and had found that in all cases the patients had never seen the prescriptions bearing their names, nor had they ever received Dilaudid from Cornish.

In four cases, McSorley said, the patients listed on the prescriptions had died before the dates listed on the prescriptions. In one instance, according to an affidavit submitted by DEA agents, Cornish signed seven prescriptions for a dead person whose death certificate he had signed himself. In yet another case, the doctor signed 17 prescriptions for a woman whose wake he had attended, the prosecutor said.

The affidavit said that most of the prescriptions Cornish wrote listed illnesses for his patients that they had never contracted, such as terminal cancer, cancer of the rectum, prostate and colon, arthritis, and chronic ovaritis.

In all, according to the affidavit, 24 names appearing on 116 prescriptions were listed at nonexistent addresses and 154 prescriptions for 35 individuals showed incorrect addresses.

Dilaudid is often referred to on the street as "hospital heroin" because it is used as a painkiller for postsurgical and terminal cancer patients and it is used by addicts when heroin is unavailable.

Each tablet of the drug, when purchased by a patient from a pharmacy, may cost about 20 cents according to the affidavit. But on the street, a tablet may sell for $34 to $35.

While the criminal information to which Cornish pleaded guilty referred only to the 100 tablets he illegally distributed, the affidavit quoted one "confidential source" in the Washington drug world as saying that he or she had paid $100 to Cornish in return for his writing a Dilaudid prescription.

Cornish, who lives at 1102 Irving St. NW and has offices at 1007 Irving, could not be reached for comment. No date was set for his sentencing.