Romania has underlined its deep foreign policy differences with its Soviet bloc allies by taking a neutral stand toward China's incursion into Vietnam.

While other members of the Warsaw Pact military alliance echoed the Kremlin in condemning Peking for its "barbarous aggression," Romania merely said that nothing could justify military action to settle disputes. An official Romanian government statement appealed to both China and Vietnam to withdraw all troops to within national frontiers -- a statement that was clearly intended to cover both Vietnamese troops in Cambodia and Chinese troops in Vietnam.

In retrospect, it is now clear that the issue of whether or not to support Vietnam against China was one of the main subjects of disagreement at the stormy meeting of Warsaw Pact leaders in Moscow last November. After the meeting, Romanian President Nicolae Ceausescu publicly revealed that he had rejected as unnecessary a Soviet proposal to increase military budgets and to strengthen the integration of the Pact's armed forces.

In a series of speeches, Ceausescu went to great lengths to explain that while Romania would remain a member of the alliance, it interpreted its military obligations as applying only in the event of "an imperialist aggression in Europe." This phrase was clearly designed to rule out in advance the possibility of getting involved in a war between socialist countries in Asia.

By contrast, other Soviet-bloc countries have supported the Soviet position that it is their duty to help Vietnam if the need arises. Asked recently what Hungary's attitude would be in the event of military hostilities between Vietnam and China, a senior Hungarian Foreign Ministry official replied: "Obviously we would be on the side of Vietnam as we also offered help to that country against the American imperialists."

In an official reaction following the outbreak of the fighting, the Hungarian Communist Party newspaper accused Chinese leaders of "rendering service to the most aggressive imperialist circles." Czechoslovakia described the Chinese attack as "reactionary and anti-socialist" while Bulgaria and East Germany called it "a serious threat to world peace."

In Prague, thousands of Czechoslovak and Vietnamese youths demonstrated outside the Chinese Embassy against what they called China's aggression in Vietnam. The official Czechoslovak news agency Ceteka also reported anti-Peking demonstrations in factories and offices across the country.

According to reliable Eastern European sources, a statement praising the recently signed friendship treaty between the Soviet Union and Vietnam was proposed for inclusion in the final communique issued by Warsaw Pact leaders in Moscow, but Ceausescu rejected it. After the summit, other Eastern European leaders made unilateral statements supporting the treaty, which provides for mutual consultation and assistance in the event of an armed attack on either of the signatories.

The knowledge that the Soviet Union was preoccupied with developments on its eastern flank may also have encouraged Ceausescu to believe that he could get away with his outspoken independence. In a series of defiant gestures, he has applauded the peace negotiations between Egypt and Israel, resisted Soviet proposals for tighter economic integration in Eastern Europe and bitterly attacked Vietnam's ouster of the previous Khmer Rouge government in Phnom Penh.

As if to underline Romani's increasingly maverick behavior, Romanian Defense Minister General Ion Coman arrived in Belgrade today for talks with his Yugoslav counterpart, Gen. Nikola Ljubicic. The two neighboring Balkan countries, which have developed similar systems of "all-people's" territorial defense in the event of an invasion, cooperate closely in military matters.

Yugoslavia, which is not a member of the Soviet bloc but has close ties with both Peking and Moscow, has also expressed grave concern at the Vietnam border war. It said the war could have unforseeable consequences for peace and security in the world. An official foreign ministry statement issued Monday night, however, refrained from criticizing China, calling instead for the withdrawal of all foreign troops to their own countries -- a position similar to the Romania's.

The Vietnamese intervention in Cambodia -- which, like Yugoslavia, is both communist and nonaligned -- was taken here as a warning that, 10 years after the Soviet-led invasion of Czechoslovakia, the Brezhnev doctrine of "limited sovereignty" of socialist countries is far from dead.