Communist Party leader Hu Yaobang said today that China and the United States have agreed that U.S. Navy ships will not be carrying nuclear weapons when they make a port call in China in a few weeks.

U.S. officials immediately denied that there had been any formal change in the controversial U.S. policy of refusing to confirm or deny whether U.S. ships making port calls carry nuclear weapons. But one official in Washington noted that since the port call to Shanghai would be largely ceremonial it was "logical" that the vessels would be conventionally armed.

The American refusal to provide explicit assurances on this question to Australia, New Zealand and Japan in the past has provoked political controversies in those countries and recently led New Zealand to ban U.S. warships from making port calls in the absence of confirmation that they carried no nuclear weapons.

Hu, widely considered as heir apparent to China's paramount leader, Deng Xiaoping, said in an interview with Australian and New Zealand journalists that China had insisted that the U.S. warships respect China's sovereignty and not carry nuclear weapons in Chinese waters. His remarks strongly suggested that the United States had not contested the Chinese condition for the visit.

Hu is to visit Australia and New Zealand on a trip that starts Saturday.

In his meeting with the journalists, Hu said, in answer to a question, that the U.S. Navy's port call would be "an informal visit" by a "conventional warship."

Asked if this meant the United States had assured China that the ships would not carry nuclear weapons, Hu said, "That is already understood between China and the United States. There is agreement. As they will enter Chinese territorial waters, that is our sovereignty, so they have to give their consent."

In Washington, a Pentagon spokesman said there was no change in the policy of neither confirming or denying the presence of nuclear weapons on ships. "We are continuing to work with the Chinese concerning the details of the proposed visit of U.S. warships to the People's Republic of China. An announcement concerning the ship visit will be made when arrangements with the Chinese are complete."

As a result of navy-to-navy negotiations that were agreed upon last August, during the visit here of U.S. Navy Secretary John F. Lehman Jr., three U.S. destroyers are expected to make a port call next month at Shanghai -- the first such U.S. Navy visit to China in nearly four decades. An American admiral is expected to be aboard.

Hu's remarks came at a sensitive time. China has just reopened a new round of negotiations in Moscow over possible normalization of relations with the Soviet Union. Hu's remarks could deflect potential Soviet criticism of China's military cooperation with the United States at a time when Peking and Moscow appear to be trying to improve general relations. Diplomats here who subscribe to this view add that Hu may also have been addressing the concerns of influential Chinese officials who feel that Peking has leaned too far in the direction of the United States.

Other observers emphasized, however, that Hu has a reputation for "shooting from the hip" by speaking bluntly or prematurely about the nuances of diplomatic and political exchanges.

Diplomats here say that the self-educated Hu's style is often direct and uncomplicated. His brashness has occasionally embarrassed his Communist Party colleagues. When Hu visited Japan at the end of 1983, he warned that if the United States failed to give a satisfactory reply to Chinese protests over U.S. congressional expressions of support for Taiwan, China would have to reconsider a planned 1984 exchange of visits by President Reagan and Premier Zhao Ziyang.

The official New China News Agency reported Hu's controversial remark at the time but then, within hours, provided a revised, toned-down version of the party chief's comment. The Chinese government later overlooked Hu's remark altogether by announcing that the Zhao visit would go forward as planned, although U.S. responses to its protests were deemed inadequate.

When China readjusted its foreign policy a few years ago and reinforced its independent posture with respect to the United States and the Soviet Union, it shifted to a more open sympathy for peace movements around the world. Although China has made clear that it favors a continuing American military presence in Asia to counter the Soviet Union, it has also favored the establishment of a nuclear-free zone.

Hu's opposition to port calls by nuclear-armed U.S. ships today came within that context.

In a separate interview published today in the English-language newspaper China Daily, Hu also said that China shared with the five nations he is about to visit -- Australia, New Zealand, Western Samoa, Fiji and Papua New Guinea -- identical or similar views in "opposing the arms race and for easing international tensions."

"We would like to work with them for peace in this region and in the world," said Hu. "We support the just stand of the governments and peoples in the South Pacific for removing the threat of nuclear war and for the establishment of a nuclear-free zone in the region."