Congressional and Pentagon leaders resolved a contentious budget feud yesterday that will avert thousands of potential forced retirements, promotion freezes and military personnel cuts, according to officials.

The agreement would shift $1.4 billion from military weapons programs, including strategic missiles and submarines, and other projects to cover shortfalls in the Pentagon's personnel and medical accounts. It was reached between House Speaker Thomas S. Foley (D-Wash.) and Defense Secretary Richard B. Cheney after six months of bitter political battles.

In a related issue, the Navy has ordered a major review of its newest, most expensive aircraft program -- the A-12 carrier-based attack plane -- after contractors notified officials that the craft's first flight has been pushed back almost a year, until late 1991, according to Pentagon spokesman Pete Williams.

Reconciliation on the budget shift came a day after Cheney met with top House and Senate leaders and agreed to study the effect of a 25 percent cut in military force structure over the next six years.

Although several top Pentagon officials have discussed potential cuts of up to 25 percent in troops and weapons programs, this is the first time Cheney has told Congress he will provide details of such a cut.

The debate over funding the military's personnel and medical accounts has centered on demands by House Armed Services Committee Chairman Les Aspin (D-Wis.) that the Pentagon use at least $235 million more than Cheney proposed from strategic weapons programs to cover its shortages in the other programs.

Other House and Senate defense and budget committee leaders had agreed with Cheney's original list, which included a few cuts to strategic programs but concentrated the bulk of reductions in other weapons.

Foley took charge of the negotiations with Cheney this week and yesterday reached an agreement in which $58 million more would be sliced from the MX and Midgetman nuclear missiles, Trident submarine and the SSN-21 Sea Wolf attack submarine.

Although Cheney had not completed discussions with all House and Senate leaders involved in the debate as of late yesterday, the members were expected to accept the agreement.

"I am glad we are going to be able to protect our personnel and CHAMPUS {medical program}," Cheney said in a statement last night. "It appears to be a good outcome for all concerned."

"What amazes me is how and why one individual would hold the entire reprogramming process hostage in the name of principle, only to settle for an amount that is 4 percent of the total package," said Rep. William L. Dickinson (R-Ala.), ranking minority member of the House Armed Services Committee, in reference to Aspin's original demands.

Aspin's press secretary said he would have no immediate comment. He has said in the past it was wrong of Cheney to protect strategic programs at the expense of personnel.

The Navy's proposed review of the A-12 plane, which remains a classified program, was sparked in part by cost projections ranging up to $100 billion, according to sources familiar with the troubled program.

Contractors McDonnell Douglas Corp. and General Dynamics Corp. reported problems in development of the plane's sensitive composite materials which are supposed to give it stealth characteristics. The contractors also cited "complexity and unanticipated delay in the tooling required to make the first few planes," according to Williams.

The Navy's review of the plane will include "aircraft design, cost and production schedule as well as contractor performance, program funding and anything else they need to look at," Williams said.

Even before the new reports from the contractors, Cheney had proposed reducing the planned buy of A-12 planes from 858 to 620.