President Reagan today described open markets as a key to peace and prosperity, and said that the "bunker mentality" of protectionism menaces the American economy and U.S. foreign relations.

Speaking to a luncheon forum of the Commonwealth Club in this cosmopolitan and trade-minded city, Reagan gave one of the staunchest advocacies of free trade he has made since becoming president. He also put a political twist to his remarks by taking a swipe at the domestic-content bill supported by Walter F. Mondale and some other Democratic presidential candidates.

The legislation would require that both foreign and domestic cars sold in this country be built with an escalating percentage of U.S. parts and labor. Reagan observed that the Congressional Budget Office had concluded that it would destroy more jobs than it would save and would add substantially to the cost of a new car.

"What the proponents of this bunker mentality never point out is the costs of protectionism for one group of workers are always passed on to another group down the line," Reagan said.

"And once such legislation is passed, every other industry would be a target for foreign retaliation. We would buy less from our partners, they would buy less from us, the world economic pie would shrink. Chances for political turmoil would increase dramatically."

When Reagan became interested in politics in the 1930s he was an admirer of Democratic President Franklin D. Roosevelt, and accepted the Roosevelt view that the high U.S. tariffs imposed after World War I had been a major contributor to the Great Depression. Reagan's beliefs on this subject remain unchanged. His speech today contained a long expository section tracing the damage he contended had been done to U.S. interests and world trade by protectionism, and warned against the danger of retaliating against U.S. trading partners who try to impose barriers against American goods.

"We and our trading partners are in the same boat," Reagan said. "If one partner shoots a hole in the boat, does it make sense for the other partner to shoot another hole in the boat? There are those who say yes, and call it getting tough. I call it getting wet--all over.

"We must plug the holes in the boat of open markets and free trade and set sail again in the direction of prosperity. No one should mistake our determination to use our full power and influence to prevent anyone from destroying the boat and sinking us all," he said.

Continuing the Rooseveltian theme, Reagan pledged to "carry the banner for free trade and a responsible financial system" that he said were "the great principles" when they were promulgated at Bretton Woods, N.H., in 1944 by the Roosevelt administration.

These principles, he said, "remain the core of U.S. policy" despite vast changes in the international trade and monetary system.

"Either the free world continues to move forward and sustain the postwar drive toward more open markets, or we risk sliding back to the tragic mistakes of the 1930s, when governments convinced themselves that bureaucrats could do it better than entrepreneurs," Reagan said. "The choice we make affects not only our prosperity, but our peace and freedom.

"If we abandon the principle of limiting government intervention in the world economy, political conflicts will multiply and peace will suffer. That's no choice at all."

Reagan also encouraged greater enterprise by American business. "We will give you less bureaucracy if you give America your audacity," he said. "We want you to outplan, outproduce and outsell the pants off this nation's competitors."

During a question-and-answer session after the speech Reagan was asked about a flat-rate tax proposal, but he appeared not to hear the question. He was given the question in writing, read it and ducked the flat-rate issue. Then he said that a simplification of the tax structure "is very much needed and we would like to be able to bring it to the people."