In a startling reversal of past hostility, the United States is being wooed with growing boldness by Asia's two major communist powers. China and Vietnam. The Carter administration is responding with flirtatious fervor to China, while keeping Vietnam at arm's length.

The maneuvers of both Peking and Hanoi arise far more from their own array of domestic imperatives and international power struggles than from anything that Washington has said or done. In both situations, the notably changed attitude toward the United States is only part of a much broader drive for improved economic and political relations with most of the world at large and for advantage over their communist rivals.

The unexpected developments in communist Asia have created policy dilemnas as well as new opportunities for the Carter administration. In contrast to their early tendency to push ahead simultaneously on all diplomatic fronts, high officials now speak openly of the complex relationships involved, both at home and abroad, in U.S. policies toward China and Vietnam.

For domestic and foreign policy reasons, the administration seems to have decided that the normalization of relations with Hanoi should await major decision-making on relations with Hanoi's rivals in Peking. The timing of China ties, in turn, is closely connected with the state of U.S.-Soviet relations and especially the domestic debate over ratification of a new strategic arms limitation talks (SALT) treaty.

"In some ways it looks as though we're better off than if we had won the war," remarked a U.S. diplomat who was deeply involved in the costly and ill-fated effort against Vietnamese troops, backed by Chinese and Soviet military aid and political support. No one would have believed at the fall of Saigon in April 1975 that the U.S. diplomatic problem over three years later would be to[WORDS ILLEGIBLE] of improved ties with Peking and Hanoi so as not to upset noncommunist Asia, anticommunist elements in the domestic body politic and the two increasingly hostile neighbor states themselves.

Normalization of diplomatic relations with China was one of the 10 major foreign policy objectives established by President Carter and his top advisers at the outset of the administration. Carter's terms, as set forth in an off-the-record talk to members of the Trilateral Commission at the White House two months ago, are reported to be continuation of U.S. trade with Taiwan, including a military supply relationship, and some indication from Peking that force will not be used against that longstanding U.S. ally.

China's decision to compromise on the wording of a Sino-Japanese peace and friendship treaty, making that pact a reality after several years of a rigid position and fruitless argument, is read here as a harbinger of potential reasonableness on the Taiwan issue. The United States encouraged the Sino-Japanese agreement, which was brought back from limbo by a private tip to Tokyo's leaders from presidential National Security Affairs adviser Zbigniew Brzezinski, on his way home from his Peking journey in late May, that China was ready to make a deal.

Peking's action last week in sitting down for the first time at an international scientific conference also attended by Taiwan's delegates may be another straw in the wind. The same could be said of some -- but not all -- of the comments of Chinese diplomats and unofficial visitors to Washington in recent days.

It has been widely rumored, without White House confirmation, that Carter would make a major effort early next year to establish full diplomatic ties with Peking and downgrade the Taiwan relationship. But even if the mainland Chinese will be accommodating -- which is yet uncertain --Carter will have to proceed with great care. A State Department internal study last Dec. 30 pointed out that while "a clear-cut majority" of the American public favors the establishment of normal diplomatic relations with Peking, an even larger majority opposes withdrawing diplomatic recognition of Taiwan.

On policy toward the great powers of the communist world, there are now effectively "two tracks" within the top rank of the U.S. government, according to a high official, with Secretary of State Cyrus R. Vance carrying on relations with the Soviet Union and Brzezinski increasingly active in dealings with China. A senior White House source, while saying this is an "oversimplification," did not deny the essence of this account.

In an arrangement sealed during Brzezinski's trip to Peking, Sino-American trade, technical, cultural and even governmental exchanges have recently blossomed despite the absence of any overt move toward the establishment of full diplomatic ties. This dramatic improvement in relations followed several years of near stagnation, and paralleled China's equally dramatic improvement in relations with Japan, Southeast Asia, eastern and western Europe and Africa.

Two cabinet secretaries, Energy's James R. Schlesinger and agriculture's Bob Bergland, have scheduled trips to China this fall and Commerce's Juanita M. Kreps is reported to be waiting in line. Scientific and academic exchanges with China have tripled this year and are expected to grow apace in numbers and qualitative depth next year. Sino-American trade, while still small, has doubled in 1978 after three lean years and is believed to be headed for much bigger things.

Brzezinski and some other high officials, reportedly enamored of "the China card" as a bargaining counter with the Soviet Union, also believe that warmer relations with the communist giant of Asia are fundamentally important in themselves. There is some sentiment in official circles for a normalization drive or some other new pro-Peking move to even the score if a U.S.-Soviet SALT-II agreement can be completed as hoped late this year or early next year.

At the same time, it is clear that upgrading of relations with Peking (and downgrading with Taiwan) would stir major domestic controversy and add new difficulties for an embattled SALT treaty. The most logical course would seem to be postponement of new China ties until after the ratification of the Soviet treaty.

Some officials believe that if the SALT negotiations falter, however, pressure will mount sharply for a "tilt" toward China that puts Peking normalization first. Adding to this possibility is the urgency about U.S. ties reportedly being expressed in private by some top Chinese officials.

While taking an official view that Washington-Hanoi relations are none of their concern, the Chinese have also made it clear that they see no reason for any U.S. steps toward Vietnam. One recurrent Chinese remark is that help of any kind for Hanoi would only lighten the burden on Vietnam's current major sponsor and supplier of aid, the Soviet Union.

Domestic public opinion, rather than international politics, appears to be the greatest barrier to improved relations with Hanoi, however. Top levels of the Carter administration reportedly decided this summer that a rapprochement with the former foe at the present time could add significantly to White House political problems without adding much of diplomatic value abroad.

The Carter administration was willing at the outset to establish normal trade and diplomatic relations with Vietnam, but Hanoi was not. It demanded that the United States agree first to supply some or all of the $3 billion in reconstruction aid which was promised by the Nixon administration as an inducement to settle the war.

Early this year, as Vietnam's war with Cambodia grew and its ties with China deteriorated, Hanoi began a drive in Asia and elsewhere for political and economic support. In recent weeks it has signaled privately and publicly on many occasions that it has dropped its precondition for ties with Washington -- but the State Department maintains it has not been "officially" told.

Tipped off by U.S. peace groups that the current embargo on U.S.-Vietnam trade expires Sept. 14, Hanoi has made its renewal a test of Washington's sincerity. U.S. oil exploration firms, airline companies and other firms recently invited to Hanoi would like to see the embargo lapse. But administration officials said the embargo will be routinely renewed.