Japanese Prime Minister Yasuhiro Nakasone called yesterday for a coolheaded approach by the Reagan administration and Congress to avoid trade protectionism that he said could lead to a worldwide depression.

At the same time, Nakasone said, the strong, long-range U.S.-Japanese ties should not be cast aside because of current tensions over the growing Japanese trade surplus with the United States and the increasingly strong feeling here that Japan keeps its markets closed while enjoying the fruits of selling freely here.

In an interview on "This Week with David Brinkley" (ABC, WJLA) taped in Tokyo before he left for Washington to meet with President Reagan Tuesday, Nakasone was vague about how he would respond to administration requests that Japan increase military spending.

But he pledged his country to a continued effort to defend itself in line with the security treaty with the United States. He gave assurances, however, that Japan has no interest in nuclear arms or in developing an offensive army. "We don't want to be a military giant," he said.

"The great danger" that could arise from current tensions between Washington and Tokyo over the $20 billion U.S. trade deficit with Japan, he said, "is that we become irritated and emotional and lose sight of our long-range interests."

"It will be in our mutual interests for both governments, for both legislatures to remain coolheaded and seek reasoned and moderate solutions. We must resist temptations to protectionism by all means if we really want to ensure economic development and growth in the whole world," Nakasone said.

He showed full awareness of congressional pressure to restrict Japanese imports to the United States but said he faces similar pulls from Japanese interest groups adamantly against allowing more U.S. beef and oranges into the country.

"I do realize that American politicians have their constituents just as we do in our country. When you have unemployment in your district, you are naturally concerned . . . . But resorting to protectionism is one thing we must avoid at all costs if we want to avoid the serious tragedy that we experienced in the '30s," Nakasone said.

Nakasone said he has made "serious efforts" during his less than two months in office to make it easier to sell U.S. goods in Japan despite opposition within his own party. When he cut tariffs on foreign cigarettes, he said, "I left, as we say, a lot of people on the platform."

Nakasone noted that "no other country imports so much of American products" as Japan, including 60 percent of U.S. beef exports and as much as 39 percent of orange exports.