When is a communist a not-so-bad communist? When he is a Chinese communist. Or so it looks to many in this capital town. It has not gone unnoticed here that the United States in the past few years has been gradually tilting toward the People's Republic of China, even as it has adopted a tougher stance toward the Soviet Union. The move away from a policy of evenhandedness in dealing with the two communist giants began even under Carter. But it has gained concrete momentum under Reagan, and especially under the effective influence of US Defense Secretary Caspar Weinberger, who has been in Peking this week talking about the eventual sale of American arms.
Mr. Weinberger ended his Chinese sojourn with the announcement that President Reagan and Chinese Prime Minister Zhao Ziyang will exchange visits next year. This means that, unless there is progress on arms talks with Moscow, Mr. Reagan will go to China before he has held a summit meeting with Soviet leaders. This was also the pattern followed by President Nixon in 1972, when he made a historic visit to Peking before going to the Soviet Union to sign the Salt I agreement.
Weinberger, Secretary of State George P. Shultz, and other US officials view good relations with China as a major asset in maintaining a global strategic balance and in keeping Soviet expansionist ambitions in check. There seems to be general agreement on this policy. But Secretary Weinberger and his more conservative allies within the administration, even while they are courting the Chinese, are trying to tighten President Reagan's policy on trade with the Soviet Union. These efforts have caused a split within the top levels of the administration between those who favor a firm but flexible stand toward Moscow and conservative forces who advocate a more hostile line.
The split broke out in the open this week when William A. Root, director of the State Department's Office of East-West Trade, resigned. Mr. Root is protesting a recommendation by an advisory group that a number of oil- and gas-exploration products be placed under national security controls, thus giving the Pentagon a veto over sales of such equipment to the USSR.
The trade recommendation, taken earlier this month without the participation of Mr. Root's key office, seems to reopen the whole issue of US economic sanctions against the Siberian natural-gas pipeline. Last November Mr. Reagan, persuaded that this policy was undermining relations with the European allies, eased these sanctions. And only recently he lifted the ban against the sale of Caterpillar pipe-laying equipment to the Soviets.
State Department officials voice concern about this renewed intrabureaucratic squabble and its possible impact on the presidency. Secretary Shultz is seen as having successfully nudged the President toward a more centrist course in foreign policy, and epecially with respect to relations with the Soviet Union. Mr. Shultz is credited also with helping repair US ties with the allies, and the concern now is that the old battle has to be fought over again.
As for US-China ties, the warming trend is viewed favorably. To some diplomatic observers, however, the move to deal more generously with communist China than with the communist Soviet Union seems incongruous. It also evokes a degree of concern.
''We should have a good working relationship with Peking,'' says former US Ambassador to Moscow Malcolm Toon. ''But we have to take into account the Soviet paranoia about China. If the Russians feel we are flirting with the supply of weapons and high technology which are denied to them, this rouses suspicion. And they're capable of doing something irrational.''
Administration officials see no direct link between Soviet leader Yuri Andropov's uncommonly tough and emotional attack on the latest US nuclear missile proposals and the Weinberger visit to Peking. They note, for instance, that the type of arms and equipment that might be sold to China falls far short of sophisticated weaponry. More likely, the Andropov blast shows the heat the Soviets are feeling in the aftermath of the Korean airline shootdown, and, in effect, reflects the degree of their embarrassment.
Still, Washington's wooing of China reverberates in Moscow. The Soviets, who broke with their Chinese allies in 1960 and who now keep a million troops on the long Sino-Soviet frontier, are acutely sensitive to what the US does in Peking. Yet, officials here note, it is usually adverse Soviet behavior that drives the US to cozy up to Moscow's Asian adversary. Remarked a high White House official: ''There is no question that when the Soviets act outrageously, this creates a common interest between the US and China.''