An admitted heroin courier testified yesterday in federal court here that convicted tax evader Linwood Gray shot a federal prosecutor here last December.

Robert L. Stuckey made the accusation as he testified in his own defense at his drug trial. He is contending in his own behalf that he participated in a massive drug conspiracy that he said was directed by Gray, but he should not be found guilty because he did so only because Gray was a violent man who controlled the organization with shootings and murders.

Stuckey also testified that Gray told him he murdered two people at a soul music festival in Maryland two years ago and that he "cut up" missing Washington disc jockey Bob (Nighthawk) Terry and killed him because he believed Terry "had swindled an amount of money" in connection with the same concert.

The prosecutor, Assistant U.S. Attorney Barry Leibowitz was shot and slightly wounded as he was walking into the courthouse here last December. One person was charged in the shooting, but those charges were later dropped by the U.S. attorney's office.

At the time of the shooting, Leibowitz was investigating the massive drug conspiracy allegedly directed by Gray. Gray was ultimately charged and tried last summer, but was convicted only of evading hundreds of thousands of dollars in income taxes. He was acquitted of all drug charges.

During the Gray trial, Stuckey was a codefendant for awhile. However U.S. District Chief Judge William B. Bryant ordered a later trail for Stuckey after his attorney said Stuckey wanted to raise in his defense that he participated in the scheme under duress.

Bryant ruled that such a defense would prejudice Gray in the trial last summer, since that jury did not know about the shooting of Leibowitz or about five or six other murders allegedly committed by Gary but with which he has never been formally charged.

According to Stuckey's testimony yesterday, Gary was receiving inside information from a Washington lawyer about the investigation while it was in progress, and the lawyer said no one else would be "interested in pursuing that investigation" if Leibowitz "took a vacation."

The lawyer, Allan M. Aplmer, vehemently denied the accusations last night. He said he did not know Stuckey and that Stuckey would not know him "if I fell in his lap."

"Other than this, there is no reason to respond to the absurd hearsay ramblings of a man facing long-term federal incarceration," Palmer said in a telephone interview.

Stuckey maintained that Gray himself told him about his involvement in the Leibowitz shooting. "Well he was shot," Stuckey testified. "Gray shot him."

Stuckey testified that the night before Leibowitz was shot, he helped Gary and another codefendant in the Gray trial, Josph Wilson, try to install a new battery in a car parked near the courthouse.

Stuckey said after he heard Leibowitz had been shot the next day, he went to Gray's house, and "Gray explained to me that he had shot Mr. Leibowitz and that if it hadn't been for Wilson's good driving, that they would have been apprehended in the area of the court building."

Stuckey also said that Gary told him to burn the getaway car and get rid of the gun.

He said he burned the car, but kept the gun in hopes that if he turned it over to authorities, "that it would release me from the fear and the bind that I had been in for the last three years."

Stuckey has said that although he made trips to Amsterdam for the Gray organization during the drug operation, he never received any payment for his help.

He said Gray coerced him into the trips by threatening him and his son.

Assistant U.S. Attorney Robert R. Chapman of the major crimes division earlier had presented government witnesses who testified that Stuckey's involvement in the drug ring was more extensive.