President Reagan will ask Congress to change the way annual cost-of-living increases are calculated for federal retirement benefits, a high-level administration aide said yesterday. The new formula would reduce the increases.

Reagan also is planning to change the formula for military retirees, veterans' pensions and all other federal retirement programs except Social Security, which is both the most costly and the most politically sensitive such program.

It was not clear last night whether these changes would affect only future retirees or those now on the rolls.

The precise new formula has not been determined, the administration aide said.

Currently, all the affected retirement benefits rise automatically each year by the same percentage as the consumer price index. The White House is leaning toward having them rise by the same percentage as pay goes up each year for federal civilian employes. An alternative standard would be to use the same percentage as wages rise generally in the economy. Both wage standards would mean smaller increases than the price-based standard used now.

Federal pay raises have lagged substantially behind increases in the consumer price index every year since 1977. Consumer prices rose 10.2 percent this year; federal workers' pay increases averaged about 4.8 percent.

The White House estimates that the proposed changes would save about $20 billion over the next two years. They are part of a larger package of proposals for cuts in basic entitlement programs that the administration is preparing in an effort to hold down the size of the deficit in the 1983 budget Reagan will send to Congress early next year.

Senate Budget Committee Chairman Pete V. Domenici (R-N.M.) and other budget experts have stressed that only by restructuring the retirement programs can the federal government begin to move toward a balanced budget.

Referred to as the "uncontrollable" portion of the budget, the cost of entitlement programs has risen an average of 13 percent annually over the last five years, according to the Senate budget panel. Budget experts estimate that even if inflation slows during the next three years, as is now forecast, the cumulative growth in the cost of Social Security and the other entitlement programs will be in excess of $225 billion if no changes are made.

Mayors and governors, complaining about having to sustain the bulk of spending reductions in their federal grants-in-aid in the first round of budget cutting while retirement programs were not touched, have urged Reagan to look at the entitlement programs and the defense budget for further cutbacks.

Most discussion on holding down the growth in retirement programs has focused on proposals for changes in the consumer price index. Experts have said it overstates the actual pressure of inflation on retirees because the formula for computing it includes home-mortgage costs, which have risen rapidly in recent years but are not an annual expense for pensioners.

Since the president and Congress jointly determine federal pay increases, tying retiree benefits to it would give them a strong lever for holding down costs.

The Social Security program is being omitted from the changes Reagan is considering making in retirement programs while a bipartisan commission studies the system's financial problems. Reagan proposed major changes in Social Security last May but withdrew them after strong adverse public reaction. The only major Social Security benefit he was able to get Congress to cut during the summer was later restored by overwhelming majorities.