Ronald Reagan accepted the endorsement of the Veterans of Foregin Wars today with a pledge to pursue a policy of "peace through strength" that he said would restore "a defense capability that provides a margin of safety for America."

In a speech that was designed to establish the basic themes of Reagan's national security policy, the Republican presidential nominee accused President Carter of making a "shambles" of the nation's defenses. And he said the administration has been "totally oblivious" to the Soviet drive for world domination.

"The response from the administration has been one of weakness, inconsistency, vacillation and bluff," Reagan told a friendly and enthusiastic audience in words similar to those he has often used on the campaign trail.

It was Reagan's first campaign speech since he was depicted last week at the Democratic National Convention as a dangerously simplistic and military-minded candidate. Reagan quipped at a press conference Saturday that the Democrats were trying to portary him as "a combination of Ebenezer Scrooge and the mad bomber."

In response today, Reagan presented himself as a man of peace who would take "prudent and measured" steps to rebuild U.S. defenses while always being willing to negotiate with the Soviets.

"I think continued negotiation with the Soviet Union is essential," Reagan said. ". . .It is important also that the Soviets know we are going about the business of restoring our margin of safety pending on agreement by both sides to limit various kinds of weapons."

But it was Reagan's willingness to be ready for war rather than this promise to seek peace which won applause from the VFW, which recently broke an 80-year tradition of neutrality to endorse Reagan for president.

Veterans understand, said Reagan, "that peace is not obtained by wishing or weakness." Defending American motives in past and recent wars, Reagan called the Vietnam War "a noble cause" in which the United States sought to defend "a small country newly free from colonial rule . . . against a totalitarian neighbor bent on conquest."

Then, in a line he has been using to rouse audiences ever since his 1976 campaign against then President Ford, Reagan brought most of the 5,000 persons in attendance to their feet by declaring: ". . . Let us tell those who fought in that war that we will never again ask your men to fight and possibly die in a war our government is afraid to win."

Reagan also won the plaudits of this convention with a systematic attack on the veterans policies of the Carter administration. To loud applause Reagan promised that he would, as president, uphold veteran's perferences in all federally funded programs.

Congressional efforts to help veterans have been thwarted "because this present anti-veteran administration has stacked the deck aginst you through the vast power of the White House," Reagan declared. He said the Carter administration steadily cut the Veterans Administration budget while the population of veterans was growing to an all-time high of 30 million.

"To me it is unconscionable that veterans in need are denied hospital and medical care because of inadequate funding which has closed hospital beds and cut health-care personnel within the VA," Reagan said.

"To me it is a breach of faiths that compensation for those with service-connected disabilities has not kept abreast of inflation and that the administration rammed through Congress a pension program admittedly designed to deny such to World War II and subsequent veterans and their survivors," he continued.

Reagan's speech today was the first in three days of campaigning on defense-related themes. He will visit a shipyard in Philadelphia on Tuesday and address the American Legion Convention in Boston on Wednesday.

Reagan's strategists hope that the speeches he gives this week will reassure voters that he has a responsible view of the world rather than ratifying the Democratic portrait of him as a simple-minded warmonger.

But the speech today seemed to fall short of ratification or reassurance, instead echoing themes in a somewhat softer manner than Reagan displayed in the Republican primaries.

In a June 18 meeting at The Washington Post, Reagan asserted that a rapid U.S. arms buildup would strain the defense-burdened economy of the Soviet Union and force the Russians to the bargaining table. Then, and again today, he said that U.S. participation in the arms race would convince the Russians that this nation means business.

"If we have the will and the determination to restore the margin of safety which this administration seems bent on losing, we can have real peace because we will never be faced with an ultimatum from anyone," Reagan said. "Indeed, the men in the Kremlin could in the face of such determination decide that true arms limitation may commence."

Reagan, as always, looked to the past. He spoke glowingly of U.S. military superiority during and after World War II and said that the failure of the Western nations to stand up to aggression had invited that conflict.

And Reagan reached even further back for an analogy which illustrated his basic theme of peace through strength.

"The great American humorist, Will Rogers, some years ago had an answer for those who believed that strength invited war," Reagan said. "He said. 'I've never seen anyone insult Jack Dempsey.'"

Dempsey was heavyweight champion of the world from 1919 until 1926.