The Labor Party governments of Australia and New Zealand publicly aired their differences today over visits by U.S. nuclear warships, an issue that threatens to divide the ANZUS alliance linking the two countries with the United States.

Australian Prime Minister Robert Hawke, who is preparing to visit Washington next month, confirmed today that he had sent a letter recently to the prime minister of New Zealand, David Lange, concerning the ship visits and the alliance.

The National Times reported that the "strongly worded letter" buttressed the U.S. position that New Zealand's ban on visits by nuclear warships is incompatible with the ANZUS treaty. Lange was said to have been annoyed by the letter.

In a statement issued today, Hawke said that although he was "concerned at false, misleading and damaging reports" about the letter, he would not release a copy, in accordance with government practice. However, he went on to describe its contents in some detail.

Hawke said he noted that his government regarded ANZUS as serving "fundamental Australian security interests" and supported visits by U.S. warships under the American policy of neither confirming nor denying the presence on them of nuclear weapons.

Hawke said he told Lange that "we could not accept as a permanent arrangement that the ANZUS alliance had a different meaning, and entailed different obligations, for different members." The letter sought Lange's views before Hawke's departure for Washington.

In reply today, acting prime minister Geoffrey Palmer of New Zealand emphatically defended the Labor government's ban on visits by nuclear-armed or nuclear-powered ships and said no outside pressures would change it.

"Our antinuclear stance will not be altered by that letter," Palmer told reporters in Wellington. He said that while New Zealand "remains committed to the ANZUS Pact," it would resist "friendly persuasion" by allies to drop its antinuclear principles. "We will not buckle," Palmer said.

He said Lange would reply to Hawke's letter following his return Monday from the Tokelau Islands. Lange also is expected to meet with his government to discuss how to respond to a U.S. intention, announced this week, to test the ban by requesting permission for a U.S. Navy ship to visit New Zealand in March in connection with an ANZUS naval exercise.

Since the United States refuses to confirm or deny whether specific ships or planes carry nuclear weapons, a ban on nuclear warships effectively precludes port calls by any U.S. Navy vessels, American officials say. The United States insists that such a ban is incompatible with the ANZUS treaty, signed by the three countries more than 30 years ago as a mutual defense pact.

Washington fears that if it allows New Zealand to skirt its treaty obligations, this could harm other U.S. alliances, a State Department official said this month.

While U.S. dealings with New Zealand reportedly have remained cordial, Washington has warned obliquely that any ban on American warships might harm agreements on New Zealand's exports to the United States.

The conflicting policies of the governing Labor parties in Australia and New Zealand also have domestic repercussions. The antinuclear left wings of the two parties reportedly have been working in tandem to keep Lange's policy on course while pressuring the Hawke government to emulate it.

In addition, Australia's new Nuclear Disarmament Party, which won one Senate seat in the Dec. 1 elections, has been strongly backing New Zealand's position. Party spokesman Peter Garrett accused Hawke today of acting as a "hatchet man" for President Reagan on the issue.

On the other hand, the conservative Australian Liberal Party has accused Hawke of endangering the country's security by not taking a sufficiently tough stand. The party favors dropping ANZUS for a bilateral defense pact with the United States if New Zealand persists in its policy.