Since deposed junk bond king Michael Milken pleaded guilty last April to securities fraud, a battle has raged behind the scenes between Congress and federal prosecutors over whether the former executive at the now-bankrupt securities firm of Drexel Burnham Lambert should be compelled to testify under immunity before a House committee.

The outcome of the battle between John Dingell (D-Mich.), chairman of the House Energy and Commerce Committee, and the Justice Department could affect Milken's sentencing, scheduled for Oct. 1, as well as the government's ongoing investigation of Drexel's demise, particularly the firm's role in the savings and loan crisis.

Yesterday, the two sides seemed to have struck a compromise, with Dingell's committee voting 42-to-1 to grant Milken immunity, but with the tacit understanding that the committee will not schedule the junk bond dealer's testimony until after he is sentenced. Milken has said he would submit to grilling from Congress if granted immunity from prosecution based on that testimony, Dingell's staff said.

On one side of the Milken tug-of-war is Dingell, who wants to chronicle a series of profitable but also "illegal or questionable" junk bond transactions, as he puts it, for which Milken and some close associates were not prosecuted.

On the other side is the Justice Department and the Securities and Exchange Commission, whose staffs hope to use information supplied by Milken to pursue civil and criminal prosecutions in connection with the 1980s takeover wave. Of particular interest to prosecutors are top officials at several large, failed or troubled thrifts that invested heavily in junk bonds, according to government sources.

Prosecutors are probing the possibility that Milken, through Drexel, traded junk bonds on behalf of several troubled thrifts in a buy-and-sell strategy that artificially inflated the price of the bonds, the sources say.

Among thrifts leading in junk bond investments are Columbia Savings in Beverly Hills, whose former president Thomas Spiegel has been sued by thrift regulators for wasting the thrift's assets on personal living expenses; Lincoln Savings in Irvine, Calif., which failed in 1988 and is now the target of the largest civil bank fraud suit in U.S. history; and CenTrust Savings in Miami, whose failure is expected to be among the costliest.

Lincoln and CenTrust alone are expected to cost taxpayers more than $5 billion.

As the junk bond market plummetted in the last 18 months, many thrifts that invested heavily in junk bonds failed, leaving taxpayers holding securities in such risky and potentially worthless ventures as Greyhound Lines, Eastern Air Lines and even in Drexel itself.

Last April, in a plea-bargain settlement with the government, Milken pleaded guilty to six felonies and agreed to pay $600 million in penalties and restitution. The charges centered largely on stock transactions and had little to do with junk bonds and nothing to do with thrifts or the partnerships Dingell has been investigating.

The Justice Department has said it will grant Milken immunity after he is sentenced, a status that will compel him to answer questions from the SEC and criminal prosecutors. Milken has said he will comply with that agreement, though he can withdraw his plea up to the time he is sentenced.

Prosecutors are afraid that if Milken is given immunity before Congress and testifies there in advance of being sentenced, Milken will lose his incentive to cooperate with prosecutors and may even withdraw his plea and try to force the government to press its case against him through a jury trial.

Prosecutors are also afraid that even if they won a conviction, Milken could seek to overturn it by arguing that the government prosecuted him using information he supplied under immunity before Congress, in violation of the Fifth Amendment's protection against self-incrimination. Last week, a federal court of appeals ruling in the Oliver North case underscored that concern. North, a former White House aide, convinced the court that witnesses in his case may have been influenced by information he disclosed while testifying under immunity before Congress. The court has ordered a review of the case.