A congressional aide who was jailed Wednesday for refusing to testify before a federal grand jury investigating alleged drug use on Capitol Hill changed his mind yesterday and agreed to answer questions before the panel.

U.S. District Judge John Lewis Smith Jr. freed Leo C. Inglesby Jr., 30, after Inglesby assured the judge he would testify at the grand jury's next session Jan. 5.

On Wednesday, Inglesby refused to answer four questions before the grand jury even though he had been granted immunity from prosecution.

He said that legislative privilege, which prohibits courtroom inquiries into legislative actions, protected him from having to answer the questions.

Inglesby is a former assistant House doorkeeper. His lawyer, Linda Huber, said he was particularly concerned that the legislative privilege doctrine might be violated if he answered questions about possible incidents that had occurred on the House floor or in nearby cloakrooms.

But after spending two nights in the D.C. Jail, Inglesby changed his mind. He will testify under an agreement Huber worked out with Assistant U.S. Attorney Daniel J. Bernstein.

Inglesby, under the agreement, will answer Bernstein's questions before the grand jury, but also next week will share whatever information he has about drug use with investigators for Joseph A. Califano Jr., the House ethics committee's special counsel investigating alleged illicit drug use on Capitol Hill.

There was no prior restriction on Inglesby talking with the Califano investigators, but Huber said Inglesby now "feels more comfortable. The House's own institution is going to be informed of what he's telling the grand jury."

Huber said her client is "not sitting on any heavy information."

Huber has said the grand jury's questions involve whether Inglesby "had seen another individual in possession of cocaine or attempting to sell it in the District of Columbia." The prosecutor has said the grand jury is investigating "an allegation of narcotic use by a lame-duck congressman."

The questions pertain to alleged incidents that occurred while Inglesby was in his doorkeeper's job from 1977 to September 1981. For the last 14 months, he has been a legislative aide to Rep. Charles Pashayan Jr. (R-Calif.).

Pashayan, who is not involved in the grand jury investigation, suspended Inglesby's $17,520-a-year salary when the aide was jailed. Yesterday he said he does not know whether Inglesby will be kept on his staff.

"I'll have to think about that over the weekend," Pashayan said. "I'll have to chat with him."