Early last November, the then little-known commander of the Argentine Army, Leopoldo Galtieri, paid a visit to Washington that marked the beginning for many Argentines of what has become their boldest and most risky foreign policy move.

Honored at a dinner attended by Defense Secretary Caspar W. Weinberger and then-national security adviser Richard Allen, Galtieri delivered a seemingly routine statement that, viewed within the unique context of Argentine foreign policy, signaled a major departure from the collapsing military government in Buenos Aires and from a long historical tradition.

The third world war, Galtieri told his hosts, had begun in the Americas, and it was a war whose battle lines were defined not by national boundaries, but by ideologies--the democracy of the United States and the communism of the Soviet Union.

Faced with this conflict, Galtieri said, Argentina had to drop its passivity and join forces with its frequent adversary, the United States.

Although Galtieri's position sounded logical for a nation known as violently anticommunist, it marked a broad new focus for Argentine foreign policy, which for decades had been anticommunist, nonaligned, often anti-Yankee and, most of all, fiercely parochial.

Five months later, that ideological stand has become both the crucial element and the most likely breaking point of U.S. Secretary of State Alexander M. Haig Jr.'s efforts to prevent a confrontation between Argentina and Britain over the Falkland Islands.

For decades, Argentina has been a country where the most parochial positions of nationalism and territorial and economic interest have seemed to take first priority in foreign policy, followed loosely by a series of sometimes contradictory alliances and positions that can best be described as pragmatic neutralism.

For example, Argentina refused to join the U.S.-backed grain embargo to punish the Soviet Union for its 1979 invasion of Afghanistan. Argentina, in fact, increased grain shipments, thus largely offsetting the stoppage of U.S. grain sales.

Since Galtieri became Argentina's president as well as Army commander last Dec. 22, his globalist ideological embrace of an alliance with the United States has been the most controversial element of a foreign policy in which multilateral strategy and traditional, narrow nationalistic issues have become intertwined.

In early January, Galtieri and Foreign Minister Nicanor Costa Mendez made clear their intentions to shift Argentina's diplomatic position from active participation in the nonaligned nations group and haughty independence from the United States to a "Latin American orientation" and strong backing for U.S. efforts to check Marxist movements in Central America.

And yet at the same time, the second and equally clear policy priority of Galtieri's administration has been on Argentina's traditional nationalistic claims to territory in the Falklands and along the border with Chile.

Many Argentines believe that even for Galtieri, the two policies were interwoven. Their new strategic relationship with the United States, the Argentines assumed, made feasible the invasion of the South Atlantic archipelago they had long thought of launching.

Now, officials here say, with Argentina's invading troops firmly entrenched on the islands they call the Malvinas, it is the new policy of trusting in the United States--and not the old one of retaking national territory--that is most in danger of being reversed.

"What the United States has failed to understand in all this," said one Argentine political source, "is the importance of this issue to the government. They didn't see that we were really serious about the Malvinas." Consequently, although relations between the United States and Argentina rarely have been closer, the alliance gives Haig far less influence on Argentine actions in the crisis than would a more traditional tie based on priorities of bilateral and regional interests.

Among Argentine officials, Galtieri's support for U.S. policy has been just as controversial in some high circles as Reagan's policy of befriending South American authoritarian governments has been in the United States.

Only months ago, groups within the military opposing Galtieri's new policy prevailed when Argentina decided, after considerable muffled debate, to reject a U.S. request that it participate in the Sinai peace-keeping force, reportedly over Galtieri's strong objections.

Now, analysts and political sources here say, Argentina may quickly reject its new U.S. ties if it is pushed too far on the Falkland question or if the Reagan administration is perceived to favor Britain. And in keeping with tradition, Argentine sources say, the armed forces will accept as new allies any country that supports its sovereignty, even if that means the Soviet Union.

In the last week, government officials here have waved their extensive economic ties with the Soviets like a red flag before Americans believed to be leaning in Britain's direction. New trade agreements with the Soviet Union were signed last week at high-profile ceremonies at the Foreign Ministry, and a stream of stories have appeared in progovernment newspapers citing military sources for reports of possible intervention by the Soviet Union on Argentina's side in the crisis.

Privately, Galtieri and Foreign Minister Costa Mendez are reported to have stressed to U.S. officials that the only winner in a South Atlantic confrontation between Britain and Argentina will be the Soviet Union, which, it is hinted, could be allowed to expand greatly its already high level of trade with Argentina.

The history of Argentine foreign policy is one of the most independent in Latin America.

Argentina is a country that refused to break relations with Germany and Japan during World War II, then presented the United States with a request for military aid before finally entering the war two months before it ended.

Argentina has not only been a strong supporter of the nonaligned nations, headed by Cuban President Fidel Castro, but in exchange for support on human rights and on the Falklands issue has voted in the United Nations for sanctions against Israel, although Israel has supplied Argentina with some of its best jet fighter planes.

In addition, Argentina, isolated at the tip of South America and dominated both economically and ethnically by Europeans, long has had rocky relations with the United States. Argentina first suspended relations with the United States in 1831, in fact, when the United States--two years before the British takeover--destroyed an Argentine arsenal on the Falklands and arrested six members of the garrison after Argentina tried to control U.S. fishermen in the area.

The United States lost all hope of real influence in Argentina during the 19th century, when it refused to allow Argentina to export its then most important products, chilled and dried beef, to the United States. Instead, Britain came to control both the meat-packing industry and much of Argentina's economy, and in the 1940s, when Argentine nationalism flowered, it was directed by populist president Juan Peron at the United States as well as Britain.

In recent years, as Argentina has refused to support the U.S. grain boycott against the Soviet Union or support some U.S.-backed sanctions against Poland, this strange mixture of policy has come under increasing attack.

"While the Western bloc and the Soviets . . . try to harmonize their actions with their political philosophy," complained the columnist J. Iglesias Rouco last November, "Argentina continues in its petty policy, its committee operations, its parochial games, as if it belonged to another planet."

As a result, Galtieri has been praised here for pushing Argentina's diplomacy along the broad lines of its own ideological and strategic interests.

Many here believed, however, that Galtieri's alliance with the United States and his determination to regain the Falklands were directly linked, and that the military expected only a mild U.S. reaction to the invasion--and controls against Britain's reaction--as an implicit part of the new U.S.-Argentine ties.

But although high Argentine officials discussed the Falklands situation with Assistant Secretary Thomas O. Enders here in early March, only a month before the invasion, the Reagan administration apparently did not grasp the seriousness of their intentions, political officials say.

Argentine officials, in turn, have been surpised by the condemnation of the invasion, believing that the United States, as an ally, should share, or at least not openly oppose, what has been one of Argentina's highest strategic priorities.

As a result, one analyst predicted, "regardless of what happens you may see a distancing of the relations when the crisis is over. The countries will remain close, but not as it was before."