Japanese Prime Minister Yasuhiro Nakasone's statements backing a stronger military role for his country generated a warning from the Soviet Union yesterday and a public controversy in Japan.

A commentary by the Soviet news agency Tass warned against making Japan "an unsinkable aircraft carrier" in defense against the Soviets' long-range Backfire bomber, saying such plans would "make Japan a likely target for a retaliatory strike."

As reported from Moscow by Reuter, the Soviet statement said that "for such a densely populated, insular country as Japan, this could spell a national disaster more serious than the one that befell it 37 years ago"--evidently a reference to the U.S. atomic bombs that fell on Hiroshima and Nagasaki in August, 1945.

Nakasone's statements in a White House meeting with President Reagan on Tuesday and a breakfast interview earlier that day with Washington Post editors and reporters dominated the news in Tokyo before the Soviet warning.

Members of the Japanese press corps accompanying Nakasone first learned of the statements Tuesday night when they read the early edition of Wednesday's Post. They heatedly protested omission of the statements from the traditionally thorough Japanese government briefings and forced officials to hold a special news conference about 2 a.m. yesterday.

In addition to Nakasone's remarks about air defense, controversy arose in Japan about his stated intention to control strategic straits near Japan to block passage of Soviet submarines and surface vessels.

Both statements were made in a tape-recorded interview with The Post. Nakasone's statements in Japanese were put into English by his translator.

Nakasone and his aides fended off questions throughout the day and, at some points, denied that he had expressed his views on these matters in the White House talks. However, a senior administration official said in a White House briefing yesterday that there had been "some specific discussion" on such questions in Tuesday's Reagan-Nakasone talks. The official declined to give details.

Asked about the statements in a late-afternoon news conference conducted in English for American and Japanese reporters, Nakasone elaborated on his remarks to Reagan and The Post. He did not specifically deny any of the statements attributed to him.

Washington Post correspondent Tracy Dahlby reported from Tokyo that, in a subsequent news conference in Japanese and broadcast live in Japan, Nakasone declared: "I did not say anything about an unsinkable aircraft carrier."

The controversy came on the last full day of Nakasone's visit here, which included an intimate family breakfast with President and Mrs. Reagan and separate meetings on Capitol Hill with Senate and House members.

In both places, the new prime minister heard praise for his initial actions since taking office Nov. 26, as well as requests for stronger and more effective initiatives in the months ahead.

Reagan, in his public farewell on the White House grounds, praised Nakasone's commitments to open Japanese markets to a greater degree and said the two leaders' consultations "have made some imprint on the first steps in the area of trade."

Reagan was not specific, but a White House briefer said that there had been no talk between the two men of a new Japanese export quota on automobiles and that discussions of U.S. beef and citrus shipments to Japan remain at an impasse. Reagan asked for "tangible progress" in removing obstacles to U.S. exports in order for Japan to prove its "good intentions."

On Capitol Hill, Nakasone was praised by Senate Majority Leader Howard H. Baker Jr. (R-Tenn.) for efforts to ease trade restrictions, increase defense spending, share military technology with the United States and repair Japan's relations with South Korea.

But Baker went on to say, at a luncheon for Nakasone, that "there is much that remains to be done before it can be said we are truly working in concert to overcome the difficulties we face and the threats that confront us."

Another participant in the Senate luncheon, Sen. John C. Danforth (R-Mo.), said the United States and Japan have come to "a dangerous point" in their relationship. "Japan has taken some steps to open its markets to U.S. products [but] no one believes Japan has gone far enough," he said.

Despite the sometimes angry rhetoric of U.S. politicians toward Japanese trade practices, Nakasone was cordially received in both houses of Congress, according to participants in yesterday's meetings.

"Nobody really jumped on him," Rep. Samuel S. Stratton (D-N.Y.) said of the House meeting. "I think he is trying to do more than anybody has done before . . . ."

In his farewell to Reagan at the White House, Nakasone said, "I am going back to Japan with satisfaction and confidence."

He said the meetings had "reconfirmed that both Japan and the United States intend to share responsibilities in the world appropriate to both countries" and declared that "frictions between our two countries can be solved by consultation between us."