China has given Britain the go-ahead to send two British Navy ships on a good will visit to Shanghai in July, a Foreign Ministry official said today.

The move could set a precedent for the first U.S. Navy visit to China in nearly four decades, some observers said.

The United States and China failed to reach final agreement on an anticipated U.S. Navy visit to Shanghai last year after Communist Party General Secretary Hu Yaobang said that U.S. ships would not be carrying nuclear weapons when they made the port call. Hu and a senior Foreign Ministry official indicated in an interview that the U.S. government had given assurances to this effect.

U.S. officials immediately denied any change in the U.S. policy of refusing to confirm or deny whether U.S. ships carry nuclear weapons.

The Chinese Foreign Ministry official would not say today whether the Chinese had asked for assurances from the British as to whether their ships would carry nuclear weapons. But the British have the same policy of neither confirming nor denying when it comes to this issue. It appeared in this case that China had sought no such assurances.

The Foreign Ministry official said it was China's policy "not to allow foreign military vessels with nuclear weapons to visit China."

Asked today whether this cleared the way for an American port call, the Foreign Ministry official said, "We've got to wait and see. We've got nothing on that."

During a visit here last week, Norman Lamont, Britain's minister of state for defense procurement, said Britain was adhering to its policy of neither confirming nor denying whether its vessels carried nuclear arms.

"We have discussed this matter extensively with the Chinese," Lamont was quoted as saying in a radio interview. "They understand our position, we understand their position, and the visits are going ahead."

Britain has sent Royal Navy ships on good will visits to China in the past but the nuclear issue became a sensitive one after New Zealand last year banned U.S. Navy visits after Washington refused to confirm or deny whether its ships were carrying nuclear weapons. The New Zealand action created a crisis within the three-nation alliance of Australia, New Zealand, and the United States.

U.S. officials considered the failure to arrange a port visit to China to be an "anomaly" in an otherwise developing U.S.-China defense relationship. The United States reached agreement some weeks ago on plans to sell China up to$500 million worth of radar and other Air Force electronics equipment.

U.S. Embassy officials here today declined to comment on the British visit.

Diplomats said France considered proposing a port visit to China in the first half of this year but decided against it, possibly because of China's insistence on knowing whether weapons on board were nuclear or not.

The Chinese attitude toward a British visit, however, seemed to indicate a change in approach, they said.