President Carter warned the Soviet Union yesterday that, with or without a new strategic arms limitation agreement, the United States will match the Soviets' defense expenditures and military force levels.

Speaking to 2,000 persons on the campus of Wake Forest University here, the president said the United States is determined not only to maintain a strategic balance with the Soviets but also is developing forces "to counter any threats to our allies our vital interests in Asia, the Middle East and other regions of the world."

While reaffirming his support for a new strategic arms (SALT) accord, Carter said:

"We will match, together with our allies and friends, any threatening power through a combination of military forces, political efforts and economic programs. We will not allow any other nation to gain military superiority over us."

The president also warned the Soviets that they risk a loss of support for detente if they do not begin to retrain their military buildup.

"We are prepared," he said, "to co-operate with the Soviet Union toward common social, scientific and economic goals - but if they fail to demonstrate restraint in missile programs and other force levels and in the projection of Soviet proxy forces into other lands and continents, then popular support in the United States for such cooperation will erode."

Carter's tough talk on military strength came after weeks of concern in the administration about Soviet military activity, particularly in the Horn of Africa, where Soviet advisers have been aiding Ethiopian and Cuban troops against Somalia.

The Soviet Union yesterday accused Carter of shifting the emphasis of U.S. foreign policy away from detente and toward threats and building up tension, Reuter news service reported from Moscow.

In an unusually swift response to a speech by the president, the Soviet news agency Tass accused Carter of grossly distorting Soviet policy with his assertion that Moscow was inclined to use its military power in Africa and elsewhere.

["From the essence of the president's speech it follows that the speech actually means a shift in American foreign policy from the earlier proclaimed course toward ensuring the national security of the United States through negotiations, through limiting the arms race and deepening detente, to a course of threats and buildup of tension," Tass said.]

The president said, "there has been an ominous inclination on the part of the Soviet Union to use its military power to intervene in local conflicts with advisers, with equipment and with full logistical support and encouragement for mercenaries from other communist countries, as we can observe today in Africa."

He also accused the Soviets of increasing their military forces in Europe "beyond a level necessary for defense." But wherever the Soviets post a military challenge, Carter said, the United States and it's allies will be prepared to meet it.

The President called his speech, which was interrupted several times by applause, "serious and sober." Its underlying purpose appeared to be not only to warn the Soviets about military intervention around the world but also to reassure U.S. critics of a new SALT accord that the administration is not weakening in its commitment to military strength.

To undersorce that theme, Carter flew from here to the deck of the USS Dwight D. Eisenhower, the nation's newest nuclear-powered aircraft carrier, to witness a firepower exercise off the coast of Georgia.

An administration offical who accompanied the president here said that Carter's reference to the development of forces "to counter any threats" around the world involves an upgrading of existing U.S. conventional forces. The purpose, the official said, is to develop "a deployable global force capability to respond quickly in areas of vital concerns to us."

"We haven't had it (that capability) sufficiently" in the past, he said.

The president devoted a good part of his speech to the buildup of Soviet nuclear forces, which he said now match those of the United States.

"We are not looking for a one-side advantage, but before I sign a SALT agreement on behalf of the United States, I will make sure that it perserves the strategic balance that we can independently verify Soviet compliance and that we will be at least as strong relative to the Soviet Union as we would be without an agreement, he said.

Specifically, Carter said that if necessary he will order full deployment of two weapons systems now in the planning stages - a second generation of the Trident submarine and a mobile, land-based missile known as MX.

The president also used the speech to try to dispel what he called "some myths" about defense issues, among them that "our defense budget is too burdensome."

While defense costs account for about one-fourth of the $500 billion federal budget, Carter said security is worth the price. He did not mention his campaign promise to cut defense spending.

"For most of human history, people have wished vainly that freedom - and the flowering of the human spirit which freedom nourishes - did not finally have to depend upon the force of arms," he said. "We, like our forebearers, live in a time when those who would destroy liberty are restrained less by their respect for freedom itself than by their knowledge that those who cherish freedom are strong.

". . . We can readily afford the necessary costs of our military forces, as well as an increased level if needed to prevent any adversary from destabilizing the peace of the world." he said.

The president was accompanied here by Defense Secretary Harold Brown, national security affairs adviser Zbigniew Brzezinski and several North Carolina members of Congress. Before beginning his prepared speech on the defense policy, Carter went out of the congressional delegation, cleary part of his renewed personal efforts to improve his standing with Congress.