The Navy recently discovered that it has paid more than $24 million in legal fees amassed in a private fight between defense contractors about profits on their jointly built F/A18 jet warplane, government officials said yesterday.

Navy Secretary John F. Lehman Jr. last week ordered the service to recover the funds from McDonnell Douglas Corp. and not to pay an additional $23.5 million in fees incurred by Northrop Corp. in the same legal battle since 1979. Lehman has told the chief executives of both companies that he does not believe that the government should subsidize their legal dispute.

The money paid by the Navy is almost enough to buy one F18, its newest generation of combined fighter-bomber jets. McDonnell Douglas and Northrop, two of the nation's defense giants, have filed suits and countersuits worth nearly $1 billion over how to share profits from F18 sales to Canada, Australia and Spain.

"It's two businessmen fighting," one Pentagon attorney said. "Under no circumstances are the size of the fees you're talking about reasonable."

A spokesman for St. Louis-based McDonnell Douglas said the company continues to believe that it is entitled to bill the government for legal fees.

The dispute comes after a similar public squabble concerning overhead charges between the Pentagon and its largest contractor, General Dynamics Corp., which billed the government for the cost of boarding an executive's dog and other expenses that the company recently agreed were inappropriate.

Gerald J. Meyer, the McDonnell Douglas spokesman, said his company will refund the money in question but has appealed the Navy's decision to the Armed Services Board of Contract Appeals.

"Our position is that defending oneself in a lawsuit is a cost of doing business, and the federal acquisition regulations say that the usual costs of doing business are allowable and should be reimbursed," Meyer said. "We believe that in defending our position with respect to the F18 we are defending government and Navy interests also."

Les Daly, a Northrop spokesman at the corporate headquarters in California, said his firm will wait to see whether McDonnell Douglas wins its appeal.

McDonnell Douglas and Northrop teamed on the F/A18 in the late 1970s, with Northrop designated primary subcontractor, after the Navy decided not to buy Northrop's prototype F17.

McDonnell Douglas is prime contractor for the carrier-based version of the aircraft, of which the Navy hopes to buy more than 1,300, but Northrop believed that it had rights to sell a land-based version of the plane overseas.

In 1979, Northrop sued its partner for $700 million, alleging, among other things, that McDonnell Douglas was selling overseas without giving Northrop its fair share. McDonnell Douglas countersued for $250 million, alleging, among other claims, that Northrop improved its F20 fighter by improperly taking advantage of McDonnell Douglas research on the F/A18.

Lehman warned the chief executives of both companies about two years ago that the Navy would not become involved in the dispute and did not want to reimburse either side for legal expenses, officials said yesterday. But an audit last fall disclosed that the Navy had been reimbursing McDonnell Douglas as part of normal overhead bills sent by defense contractors to the Pentagon.

In a memo last Thursday, Lehman ordered his top finance official to recover those funds and then took a harder line, saying the Navy should bill the companies for millions of dollars in costs incurred by the Navy during the last five years of pretrial jockeying.

He noted that the Navy has had to produce more than 155,000 documents, of which 35,000 are classified.

Pentagon officials said McDonnell Douglas has billed the Navy for outside counsel, internal legal costs and time that company engineers and