A U.S. District Court judge yesterday ordered an aide to Rep. Ronald V. Dellums (D-Calif.) to testify to a grand jury investigating alleged drug use on Capitol Hill or face going to jail for contempt of court.

The aide, John C. Apperson, had been subpoenaed by the grand jury last month but declined to testify, citing constitutional protection against self-incrimination, according to sources familiar with the investigation. Prosecutors then asked U.S. District Court Chief Judge Aubrey E. Robinson Jr. to grant Apperson limited immunity from prosecution and to order him to testify. At a closed hearing yesterday, Robinson granted that immunity, and ordered Apperson to testify July 6.

Apperson's name first surfaced during the sentencing hearing of Robert T. Yesh, a longtime employe in the House doorkeeper's office. Yesh pleaded guilty at a closed hearing March 9 to one count of conspiring with Dellums and Apperson, and to one count of possession of cocaine. When he sentenced Yesh two months ago, U.S. Magistrate Arthur L. Burnett unsealed the records of the March 9 hearing. According to the records, Yesh alleged that he sold cocaine and marijuana to Dellums, and that Apperson served as a go-between for the seven-term congressman.

No charges have been filed against Dellums or Apperson, both of whom deny any wrongdoing. One of Dellums' lawyers, Samuel J. Buffone, said yesterday that "We remain confident of Congressman Dellums' innocence and are not concerned about any testimony any witness may give regarding the allegations."

Neither Apperson nor his lawyers could be reached for comment yesterday. If Apperson does not testify and is successfully prosecuted for contempt, he could be jailed until the grand jury's 18-month term expires in August. A new grand jury, expected to be empaneled in September, could reissue a subpoena for him.

At the March 9 hearing, Assistant U.S. Attorney Daniel J. Bernstein told the court that if the case against Yesh went to trial, the government would prove that on a total of six occasions in 1980 and 1982, Yesh sold marijuana and cocaine to Dellums or to Apperson.