The Japanese government suffered a new shock today when a former American ambassador asserted publicly that nuclear-armed U.S. naval vessels have routinely been permitted to dock at Japanese ports.

It was a second major embarrassment for the government of Prime Minister Zenko Suzuki, already stung by a U.S. defense cooperation controversy that resulted in the resignation last week of Foreign Minister Masayoshi Ito.

The comments by former ambassador Edwin Reischauer contrasted with two decades of official U.S. silence on the issue and carefully worded declarations by Japanese governments that American nuclear arms are not allowed into this country's waters.

Reischauer's account, denied today by the government, touched off a stormy controversy, with opposition parties accusing officials of lying for 21 years. The issue of nuclear weapons is one of the touchest in Japan, where two atomic bombs were dropped in World War II with vast loss of life, and a succession of governments has tried to avoid the question of whether U.S. naval forces carry them here.

In 1974, a major political furor erupted here after a U.S. admiral testified before Congress that American ships carrying nuclear weapons did not unload those weapons when visiting Japan.

After two months of intense pressure from opposition political parties, the government then in office issued a statement saying that it was Japan's policy not to alow U.S. warships carrying nuclear weapons to be in Japanese waters, but not clearly saying that this policy was insisted on at all times.

Suzuki has ordered an investigation of Reischauer's remarks while disputing the. The U.S. Embassy refused to discuss the incident, repeating its standard statement that it could "neither confirm nor deny" the presence of nuclear weapons aboard American ships using Japanese ports.

[In Washington, State Department spokesman Dean Fischer said, "Our poicy is not to discuss publicly deployment of nuclear weapons."]

Reischauer, now a Harvard professor, was ambassador here from 1961 to 1966. In an interview with the Mainichi newspaper at his home near Boston, he said nuclear-armed U.S. aircraft carriers and cruisers have called at Japanese ports. He was quoted as saying it is time for Japanese governments to "simply recognize the fact."

In later interviews with Japanese publications, Reischauer said an oral agreement in 1960 permitted the ships to carry nuclear weapons in Japanese waters and into ports.

[Reischauer said at a news conference called for Japanese reporters at his Harvard office that he was quite surprised" by the furor his comments touched off, the Associated Press reported. "I've spoken about this and written about it in the past," he said, according to AP. "That's why I find it so surprising that this has generated so much interest."]

In 1960, the two countries renegotiated their mutual security agreement, which said nothing specifically about Navy ships and nuclear weapons.

The understanding has been that the question of bringing U.S. nuclear arms of any sort into Japan, like all military steps, would be the subject of prior consultation between the governments. There is no public record of any such consultations permitting nuclear weapons onshore or in Japan's waters.

While neither government has been willing to discuss the delicate issue, it is widely acknowledged privately that such weapons are on U.S. ships based here or passing through Japanese waters.

The polite diplomatic fiction has been continued because of fear that public opinion would not accept nuclear weapons here. Widespread rioting accompanied the renewal of the U.S.-Japanese security treaty in 1960 and anti-American organizations have repeatedly attempted to undo the treaty by claiming it secretly permits nuclear weapons near Japan.

Japan Socialist Party Chairman Ichio Asukata, in a scathing attack, said today that for 21 years Japanese governments and the ruling Liberal Democratic Party "cheated" the public by denying the presence of nuclear arms on American ships here.

He said the practice "raised the threat of nuclear attacks around Japanese ports by enemies of the United States, which could endanger Japanese.

The government, meanwhile, tried to play down the issue. Chief Cabinet Secretary Kilchi Miyazawa, who as foreign minister issued the ambiguous 1974 statement, observed that Reischauer is now a private citizen, which makes it unecessary to seek a formal response from the U.S. government.

He said the government's position is still that any nuclear-armed ships would be the subject of prior consultation with the United States.

Political sources said it appeared likely that the Suzuki government, with its large majority in the paliament, could weather the tough questioning and survive with the familiar denials.

But they also said it would be an important test of competence for Suzuki, who already has been weakened by his vacillations on defense pledges to the United States.

Suzuki, during a visit to Washington 10 days ago, used language that seemd to promise an increasing level of defense and a wider military role in the Pacific for Japan as requested by the Reagan administration.

But when he returned to Japan, Suzuki denied making any new commitments and blamed the Foreign Ministry for having allegedly misrepresented his views in drafting his final communique with Reagan. Ito, the foreign minister, resigned after being personally confronted with Suzuki's complaints.

The prime minister was widely criticized in the Japanese press today for inconsistency. Editiorials said the incident raised the question of his competency in foreign affairs.