For nearly a year, the Carter and Reagan administrations did their utmost to prevent public disclosure of the existence of two secret electronic monitoring stations operating in China with American equipment and manned by Chinese personnel.

The Carter administration succeeded in keeping the story out of print, but the Reagan administration did not, although vigorous attempts by top-level officials to forestall publication continued into the late afternoon Tuesday just before NBC television's nightly news went on the air.

The NBC report was not the first public reference to the secret monitoring stations, but it had the greatest national and international impact. m

Anchorman John Chancellor opened by saying:

"Good evening. The United States and the People's Republic of China have been watching missile tests in the Soviet Union for the past year from two secret monitoring stations deep in China . . ."

NBC then switched to diplomatic reporter Marvin Kalb in Washington for the actual report, with accompanying film that included street scenes in Tehran showing wildly cheering crowds hailing Iran's revolution. Among other things, the upheaval had wiped out electronic eavesdropping posts operated by the United States for years on the Iranian-Soviet boarder. The monitoring installations now in China are replacements for that major intelligence loss.

Existence of the monitoring posts had been reported obliquely last Sunday in The Washington Post and, as a consequence, less obliquely in one pararaph of William Safire's column entitled "Essay" in The New York Monday.

In piecemeal fashion, veils were being removed from a behind-the-scenes debate involving the government and press about publishing a story that officials of two adminisrations tried to keep out of print.

Ironically, the beginnings of the story had been known since at least April 20, 1979, when China's offer to replace the Iranian monitoring stations was reported on the front page of The Post, and perhaps other newspapers subscribing to The Post's news service. Under a Hong Kong dateline, Jay Mathews of The Post's Foreign Service reported:

"Chinese Vice Premier Deng Xiaoping . . . said today that China is willing to use American equipment on Chinese soil to monitor Soviet compliance with a proposed new arms limitation treaty, according to U.S. senators visiting Peking."

The report also said Deng, "in response to a question from Sen. Joseph R. Biden Jr. (D-Del.) made clear that the monitoring stations would have to be run by Chinese and that Peking would share the collected data with Washington."

The delegation's leader, Sen. Frank Church (D-Idaho), then chairman of the Senate Foreign Relations Commitee, told reporters who asked for his reaction to Deng's offer: "We'd have to pursue the matter further."

To an even half-alert Soviet intelligence officer here, that report surely resulted in the clang of alarm bells back to the Kremlin.

It should have been obvious that the U.S. government, and the Central Intelligence Agency in particular, were unlikely to pass up such an opportunity, especially when loss of Iranian monitoring posts was a very troublesome issue for the Carter administration in its attempt to complete the second strategic arms limitation treaty (SALT II). That pact finally was signed by President Carter and Soviet President Leonid Brezhnev a few months later in Vienna, but never ratified.

Similar alarm bells should have rung in U.S. newspaper offices about any follow-up on Deng's offer, but journalism has its peculiarities. It was not until November, as best as can be established, that The Times had the story, or as much of it as was available then.

Newspapers tend to hold their secrets very tightly, so this account is not necessarily complete.

Existence of a monitoring "facility" in China became known to Richard R. Burt, then national security reporter for The Times, who had a reputation for "breaking" what government officials regarded as some of the most sensitive stories, and to his Times colleague, Phillip Taubman.

The monitoring secret reportedly also became known about that time to one or two other journalists, but not to any reporters at The Post. According to journalistic sources, The Times was talked out of publishing the story last November on "national security grounds" by Carter's national security affairs adviser Zbigniew Brzezinski and perhaps others.

These sources said The Times again was talked out of publishing the report as a prominent news story as recently as last Tuesday by CIA Director William J. Casey. At that point, the story had been reported Sunday in the context of an overall review of China policy in The Post by this reporter, and then by Times columnist Safire Monday.

By that time Burt had become what insiders traditionally label a "poacher turned gamekeeper." He left The Times after being named director of the State Department's Bureau of Politico-Military Affairs, becoming one of the administration's prime keepers of secrets.

The monitoring story's impact had increased greatly by Tuesday as a result of the U.S. decision to authorize the first sale of "lethal" U.S. military equipment to China on a case-by-case basis. As a consequence, by Wednesday the story was of primary importance and interest all news outlets, and they were able to verify it on a "background" basis.

The Times published a detailed account by Taubman yesterday morning, and ritualistic replies of "no comment" then rose in inevitable chorus during the day from the White House, Pentagon and State Department.

Existence of the listening posts obviously was no secret to the Chinese and very probably not to the Soviets. Nevertheless, leading U.S. intelligence officials were chargrined by the splash of national and international attention which, they maintained, could rebound to curg U.S. access to data on Soviet missile tests.

A White House official, asked last night about any state of alarm there, said, "I don't detect any undue alarm. Exasperation? Of course."