A federal judge in the District ordered a legislative assistant to a congressman jailed yesterday after the aide refused, even under a grant of immunity from prosecution, to answer four questions before a grand jury investigating alleged drug use on Capitol Hill.

The congressional aide, Leo C. Inglesby Jr., 30, told U.S. District Court Judge John Lewis Smith Jr. that federal prosecutors and Drug Enforcement Administration agents were engaging in a "witch hunt" in their investigation and that under the doctrine of legislative privilege, which prohibits courtroom inquiries into legislative actions, he should not be required to answer the questions.

Smith, who earlier had granted Inglesby immunity from prosecution, disagreed, telling him, "Your actions are not heroic."

The judge found Inglesby in civil contempt of court and ordered him jailed until he agrees to testify, or until next Aug. 4, the end of the grand jury's term.

"You hold the key to your own cell block," Smith told Inglesby.

Linda Huber, Inglesby's attorney, immediately attempted to get the U.S. Circuit Court of Appeals to block Smith's order or to release her client on bail pending appeal.

But late yesterday afternoon, Appellate Judges Patricia M. Wald and Antonin Scalia denied Huber's requests and Inglesby was sent to the D.C. Jail for the night.

Assistant U.S. Attorney Daniel J. Bernstein told Smith that the grand jury is investigating "an allegation of narcotic use by a lame duck congressman. The grand jury is trying to determine whether there's any merit to that allegation."

Bernstein declined to name the congressman being investigated.

Sources familiar with the investigation have said that an informant who was named as an unindicted coconspirator in an indictment last month helped federal investigators tape a conversation last summer with Rep. Barry M. Goldwater (R-Calif.).

Goldwater gave up his House seat and unsuccessfully sought the Republican Senate nomination in California. His House term ends next month.

Signy Ellerton, Goldwater's spokeswoman, said yesterday that he has not been contacted by Justice officials about the investigation. She said that Justice Department officials told Goldwater's lawyer the congressman was not a target of the probe.

Inglesby is a legislative aide to Rep. Charles Pashayan Jr. (R-Calif.) and has worked for Pashayan for the last 14 months. But Bernstein and Huber both said the questions Inglesby is refusing to answer pertain to alleged incidents that occurred while he was an assistant House doorkeeper from 1977 to September 1981.

Bernstein said "there is no evidence that Pashayan is in any way personally involved in this grand jury investigation."

Pashayan said last night that "because of the circumstances, I've suspended his Inglesby's salary," of $17,520 a year. Pashayan also said that he has "written him a letter urging him to change his decision and answer the questions."

Bernstein said that Inglesby is not a target of the investigators. He declined to say what four questions Inglesby is refusing to answer. Huber, while also declining to reveal the specific questions, said they involve whether Inglesby "had seen another individual in possession of cocaine or attempting to sell it in the District of Columbia."

In court, Inglesby told Smith the investigators were trying to "pressure employes of the doorkeeper's office to press the investigation of the Democratic cloakroom. They DEA agents treated me in a threatening and intimidating manner."

Bernstein said Inglesby's refusal to testify will have "a tendency to frustrate the grand jury's probe. But the grand jury investigation will continue to pursue other leads that are presented to it by the Drug Enforcement Administration."