President Reagan, who had vowed to rebuild America's defenses at virtually any cost, is now prepared to reduce projected defense spending by "up to $30 billion" in fiscal 1983 and 1984 to meet his goal of balancing the budget, White House spokesman Larry Speakes said today.

The retreat on defense spending is a sign that administration officials recognize that a balanced budget is crucial to winning support for their economic program on Wall Street and with the public. It also recognizes that the deficits cannot be eliminated without touching the Pentagon budget, regardless of earlier statements.

The White House today reaffirmed that Reagan would make good his pledge to increase defense spending by an average of 7 percent a year, despite those cuts. "We firmly believe he will be able to meet that target," Speakes said.

But he added that the administration would use the fiscal 1981 budget as its base for measuring those increases, rather than a higher figure favored by the Pentagon.

Speakes said that the administration remains committed to holding the budget deficit for 1982, which begins Oct. 1, to $42.5 billion. But he said further cuts in the 1982 budget, approved just before Reagan and Congress began their August vacations, may be necessary because high interest rates have swollen the administration's spending projections.

"The president is going to be out with a sharp knife on the '82 budget in order to hold the line," Speakes said. He added that no final decisions have been made on whether to seek reductions in the fiscal 1982 defense budget.

The decision to cut $30 billion out of projected defense spending in fiscal 1983 and 1984 is a significant political concession by an administration that has presented a five-year defense plan of $1.6 trillion and talked only in terms of increases.

It is perhaps the most dramatic step yet by the administration to erase doubts in the financial community that its economic recovery program can reduce inflation and bring down interest rates.

Interest rates remain at near-record levels, and the stock market has been in a deep slump. The pessimism on Wall Street has taken its toll among the president's advisers, who see their rosy economic predictions battered by tight money and high interest rates.

Administration officials hope that the president's willingness to cut the Pentagon budget this much will help them obtain even deeper cuts in non-defense spending, not only in future years but in the more crucial fight over the fiscal 1982 budget already approved.

Reagan's willingness to reduce the Pentagon budget by $30 billion represents a victory for budget director David A. Stockman and presidential assistants Edwin Meese III and James A. Baker III, who had argued in favor of deeper defense cuts as the only way to achieve a balanced budget by 1984.

They were opposed by Secretary of Defense Caspar W. Weinberger, Secretary of State Alexander M. Haig Jr. and CIA Deputy Director Bobby Inman, who argued that the president's campaign pledge to rebuild the nation's defenses required the larger military outlays already outlined by the administration.

White House officials stressed that Reagan had taken no final action on the 1983 and 1984 defense budgets, and a fierce battle over the final size of the cuts is expected in the next week. "He has not decided the extent or the magnitude of the cuts," a White House aide said today.

Reagan is expected to receive, possibly on Wednesday, a series of options from Weinberger showing how the defense budget can be reduced in 1983 and 1984. Described by one Pentagon official as "a reverse wish-list," the papers will show Reagan how much the defense establishment will be affected by various levels of cuts.

Final decisions could come at a Cabinet meeting in Washington next week.

Speakes said the willingness to make cuts in 1983 and 1984 will not affect pending administration decisions on any strategic weapons systems, including the MX missile. The administration hopes to make a decision on basing the MX by the middle of September.

The administration had estimated earlier that it would need to cut $75 billion out of the fiscal 1983 and 1984 budgets to eliminate the deficit by 1984. Speakes said $35 billion would be cut from the 1983 budget and $40 billion from fiscal 1984. The $30 billion in defense cuts will be part of that plan, leaving about $45 billion in non-defense cuts still to be made.

Private economists predict that the administration will be forced to cut substantially more than $75 billion to balance the fiscal 1984 budget. And the administration could face further problems because its projections already include $15 billion to $20 billion in Social Security cuts for those years that Congress has not yet enacted.

In addition, a deficit of more than $42.5 billion in fiscal 1982 would spill over into future years, requiring even further reductions.

The defense budget dispute has largely been fought out with two things in mind: Reagan's pledge to increase defense spending by 7 percent a year and his commitment to balance the budget.

Much of it is a numbers game, and Reagan apparently has opted for using the smallest possible base for calculating his annual defense increases. Stockman had favored using the fiscal 1981 budget figure of $171 billion, while Weinberger wanted to measure further increases against the fiscal 1982 figure of $222 billion.

By using the lower base, Reagan will be able to meet his 7 percent target and still cut substantially from future Pentagon budgets. Once it was clear which base figure Reagan used, it was possible to determine how much in defense cuts the administration could make and still keep the president's promise.

The decision to cut the Pentagon budget grew out of two meetings held in California during Reagan's month-long vacation. The first was held in Los Angeles and was attended by the president. The second was held in Santa Barbara, Calif., and Reagan did not attend.

At the first meeting, Stockman presented two options for balancing the budget by 1984. One called for non-defense cuts of $75 billion, the other for a mixture of defense and non-defense reductions. The first option was rejected immediately. "It was obvious it would be politically difficult and legislatively impossible," a White House official said today.

Weinberger was asked at the end of that meeting to begin assembling cost estimates on various defense cuts.

Meese, Stockman and Weinberger met again in Santa Barbara last week to go over Weinberger's figures. "The upshot of the meetings was to direct Weinberger to go to the Defense Department and come back with recommendations that were clear-cut and that would spell out what the cuts would affect in military spending," Speakes said today.

Those estimates, which have been developed by the Defense Resources Board at the Pentagon, are what Reagan will receive this week.

After Reagan decides how much to cut military spending, the Office of Management and Budget will begin making final decisions on recommending non-defense cuts for fiscal 1983 and 1984.

At the Pentagon today, chief spokesman Henry Catto was asked if the potential budget reductons marked some kind of "sea change" in an administration where military considerations seemed to drive budgetary considerations until now. Catto declined to accept such characterizations, stressing that no final decisions had been made yet on what, if anything, would be cut.

Less than a week ago, Catto told reporters "I would be very surprised" if the defense budget is cut back. Today he acknowledged that the armed forces have been asked to take another look at their priorities and various alternative levels of spending in the light of "new realities" that the government may not have as much money as originally thought.

Other senior defense officials today described pressures within the Pentagon as "fierce."

Asked if possible reductions might affect new strategic projects such as the MX missile and B1 bomber, Catto reverted to an old song that includes the line, "The knee-bone is connected to the thigh-bone."