A longtime acquaintance of Mayor Marion Barry's accused the U.S. attorney's office yesterday of bringing drug charges against him vindictively because he refused to cooperate in its investigation of D.C. contracting.

Herbert Young, who surfaced in the contracting investigation last month when it was reported that he had told Barry about possible FBI surveillance of the mayor's home, asked a federal judge to dismiss an indictment issued two weeks ago charging that he distributed cocaine last October.

In papers filed in U.S. District Court here yesterday, Young said he could show that he committed no crime and that before his arrest he had been cooperating with the government in an unspecified investigation. It was unclear when Young's alleged cooperation with the authorities had ended and whether his cooperation had been in connection with the contracting probe.

Young charged in court papers filed by his attorney, G. Allen Dale, that 10 months after the alleged drug offenses occurred, Young was arrested and told by federal prosecutors that charges would not be filed if he cooperated in the contract investigation.

Dale yesterday declined to comment.

The court papers said that prosecutors acted vindictively in bringing the charges only after Young refused to cooperate in the contract probe, which they said was unrelated to the alleged drug offense.

A spokesman for U.S. Attorney Joseph E. diGenova declined to comment on Young's allegations, saying prosecutors would file a response in court.

Young, the head of Aafro Construction Co. and a longtime associate of Barry, has described himself to acquaintances as a "fence-straddler" who provided some information to the FBI about possible irregularities in the award of D.C. contracts while at the same time attempting to gather information that could be used to undermine a 17-month undercover contract investigation.

Young also has told acquaintances that prosecutors offered to strike a deal on the drug charges after his arrest last month if Young would provide information about how he obtained $41,000 in city business he obtained in May after telling Barry that an FBI agent was watching the mayor's house.

According to sources, Barry referred Young to David E. Rivers, then-director of the D.C. Department of Human Services. Sources said Rivers told department officials to find work for Young.

Barry denied making the referral and Rivers has denied any wrongdoing.

Young, according to one source, was one of several Barry associates who were able to obtain sensitive investigative information from law enforcement agencies that some city officials were then able to use to hinder the federal probe of contracting irregularities.

An FBI clerical employe under investigation for allegedly providing information about the probe to Barry associates resigned last month.

The indictment against Young stems from two alleged cocaine sales last Oct. 14 and 16. It also charges him with unlawful use of a telephone during the alleged sale of $1,950 worth of cocaine to an undercover FBI agent Oct. 7.

Young has denied selling cocaine.