THE SUBJECT was El Salvador, a small country on the west coast of Central America, but many of the arguments and declarations this past week have really been about what happened in Vietnam, far across the Pacific on the east coast of Asia. For both proponents and opponents of the Reagan administration's policy toward Salvador, Vietnam provides the emotional kindling, the passion, as well as the frame of reference for a new national debate.

Secretary of State Alexander M. Haig Jr., in a recent confidential briefing for foreign diplomats, gave a solid clue to his line of thinking. Haig twice volunteered the Vietnam analogy, according to a transcript that later was leaked, but in a way that few of envoys could have anticipated. "Off the record, I wish to assure you we do not intend to have another Vietnam in El Salvador" -- and before the envoys couild exhale, he added, "and engage ourselves in another bloody conflict where the source rests outside the target area."

"The source," in his lexicon, is Cuba, which is said to be providing external support for Salvadoran insurgents. Of this Cuban "source" in the "target area," Haig added, "We do not anticipate dealing with that situation in the historic sense of what we did in Vietnam." Haig did not spell out this "historic sense" to the diplomats, but at other times he has said that the Vietnam war, if fought differently, could have been won.

On the other side of the debate, those who envision the rice paddies of Vietnam when considering the insurgency in the coffee groves of Salvador also have begun to raise their voices. Rep. Clarence D. Long (D-Md.), chairing a headline-making meeting last Wednesday of his House Appropriations subcommittee, declared that he was the only American whose son saw action and was wounded in Vietnam while his father voted on the war in Congress. "This administration, I am convinced, is making very much the same kind of mistakes that an administration of my own party was making 15 years ago," Long said with much emotion.

To an assistant secretary of state who came before him with reassuring words about the limits of the El Salvador enterprise, Long said, "I listened to all these people with their nice blue eyes and beautiful medals coming and saying, 'We are not going to get involved in a land war in Asia.'" He recalled that $9 billion in American weaponry was poured unsuccessfully into Vietnam and that the United States began there, too, by providing "military advisers." Long worried out loud that "this is going to be gunboat diplomacy all over again."

In short, there is no agreement about El Salvador in part because there is no agreement about Vietnam. Despite books and motion pictures and recollections and the passage of time, Americans remain divided about what went wrong in the failed war in Asia.

Was it, in the light of hindsight, "a mistake to intervene in Vietnam," as Cyrus R. Vance told the Senate Foreign Relations Committee in 1977 at the haring on his nomination to be secretary of state? Vance, who had been one of those directed the war from the Pentagon in the Johnson administration, said "the lessons of Vietnam" were that the United States couild not prop up a regime that lacked popular support, that democratic institutions could not be imposed on alien cultures, that a country must have the support of its allies in such undertakings, and that a nation must understand the limits of military power against guerilla forces.

Such views were the conventional wisdom of the late 1970s, and an underpinning of the deep reluctance by the Vance faction of the Carter administration to become involved militarily in wars of the Third World. Vance's determination, for example, kept the last administration from military gestures or involvement in Ethiopia, where Cubans turned the tide of war against an invasion from Somalia. Instead, Vance used political pressures through the Soviets to dissuade the Cubans and Ethiopians from a counter-invasion of Somalia. It is important to remember, moreover, that the use of military force in the chancy and unsuccessful hostage raid in Iran last April, despite his strong objections, brought Vance's resignation as secretary of state.

A clear statement of this caution about intervention came from Jimmy Carter in February 1979, shortly after the fall of the shah of Iran, an event which can be fairly said in retrospect to have doomed his presidency due to its eventual economic and political fallout. "We can't decide what kind of government Ethiopia shall have or what kind of government South Yemen shall have, or what kind of government Iran shall have," Carter told me in an interview. Everyone must understand, he continued, that "we don't have the ability to intrude ourselves into the internal political structure of any nation on earth and control the political processes there, unless we want to get another Vietnam going."

"America is no longer the America it was, and that's largely attributable to Vietnam, the mistakes of Vietnam," said Alexander Haig during his brief try at presidential politics in mid-1979. But Haig's rendition of those mistakes was startingly different from that of Cyrus Vance, who was his original sponsor in the high ranks of the Pentagon.

During his political interlude, Haig said that Washington should have reacted to communist challenge in Vietnam in the mid-1960s with vigorous and direct steps, "up to and including mobilizations." That way the United States, he said, could have done the job "right" and might have not have had to do it at all.

In a slightly earlier (1978) television interview, Haig said that "at any particular juncture the war could have been ended very rapidly had an American president been able to apply the full range of American power to bring a successful outcome." This is close to the view expressed more starkly in political terms last week by Ronald Reagan as he presented the Medal of Honor to a Vietnam veteran at the Pentagon. The president charged that American fighting men had not been defeated in Vietnam but had been "denied permission to win."

In this view, Vietnam was a military failure for military reasons: excessive gradualism in the application of 500,000 American troops and 15 million tons of munitions, and an inability to cut off supplies from the outside enemy "source." Haig was acutely aware of the problem of supply-line "sanctuaries" both as a combat leader in Vietnam and later from a key White House staff position in the Nixon administration, where he was intimately involved in the secret bombing of the Cambodian sanctuaries; and a strong advocate of the heavy 1972 Christmas bombing around Hanoi and Haiphong.

The underlying difference of opinion about Veitnam, as in the early debate about El Salvador, revolves about the nature of reality on the ground. The basic question is: "What is the fundamental problem in the embattled country?" There is little doubt, in both cases, that historically rooted political and social struggle is one part of the reality, and that externally aided paramilitary struggle is another part.

The Carter administration, until its final weeks in office, sought to place its Salvadoran emphasis on the internal political problem there. The Reagan administration has stressed the external aspect.

The State Department "special report" issued last Monday declared that "over the past year the insurgency in El Slavador has been progressively transformed into another case of indirect armed aggression against a small Third World country by Communist powers acting through Cuba." It cited chapter and verse, largely from captured documents, of the outside arms supply for the Salvadoran left, and siad far less about the political and social factors.

The state Department report also showed, though not much was made of it, that the outside aid was solicited and generated by the long-established forces of internal rebellion. Part of this aid, in a link to the past, was American weaponry reportedly supplied to the Salvadoran left by the Vietnamese from their captured stocks. If this is correct -- and the Defense Intelligence Agency claims to have solid proof from the serial numbers of close to 100 M16 rifles captured last month in Honduras on the way to Salvador -- it is the first documented case of Vietnam's willingness to send its war booty to a country outside Indochina.

Last week's rendition of the problem at hand was notably reminiscent of the State Department's February 1965 special report, or white paper, titled "Aggression from the North." Ignoring the internal political and social aspects of the Vietnamese conflict, which in some respects was the last act of a long colonial struggle, the Johnson administration's paper declard that, "In Vietnam a Communist government has set out deliberately to conquer a sovereign people in a neighboring state." What the State Department called "massive evidence" from captured documents, arms and prisoners spoke to the international and external aspects. This was the justification of the 1960s for dispatching arms aid, military advisers, U.S. Marines and finally a vast expeditionary force of Americans.

In both cases the formal appeal to the American public, in a tight focus on external communist support, glossed over the global and strategic rationale which was privately discussed in high circles of government. The U.S. response was to be a signal of American determination, with worldwide implications and repercussions. In its day Vietnam was "the place to draw the line" against the communist tide, especially against the Chinese hordes, then seen as the most virulent and threatening manifestation of international Marxism. Today China is a friend verging on an ally, and Cuba is the Soviet "surrogate."

All this is not to argue that El Salvador is a Central American carbon copy of Vietnam, a case of history relived. There are important differences in geography, history and setting between the two nations and the Washington policymaking bearing on them. El Salvador, for one example, is much smaller and much closer to home. Island Cuba, for another, is a more vulnerable "source" than North Vietnam, backed up to the Chinese border.

Nonetheless, it is undeniable that the ghost of Vietnam past falls across the El Salvador issue today. Some of those who back a new American interventionism are doing so, in fact, to exercise the "Vietnam syndrome" which inhibited the use of American physical power abroad in recent years.

It is said that that those who do not remember the past are doomed to repeat it. The problem here is that, as the nation heads into a new "noble cause" or a new "mistake," the past is remembered differently by different Americans.