The ghost of the U.S. debacle in Lebanon is haunting the congressional debate over the Reagan administration's plan to engage U.S. military forces in the notoriously unpredictable Middle East on behalf of a little-known Arab ally.

If all goes according to schedule, early next month the United States will begin providing a military escort in the war-afflicted Persian Gulf to 11 Kuwaiti oil tankers flying the Stars and Stripes as a "flag of convenience."

But the Reagan administration has no plans to extend such protection to U.S.-owned ships flying Liberian or Panamanian flags or to Iranian-owned or chartered tankers under attack from Iraq, which began the "tanker war" in 1984. Nor does the administration have plans to pressure Iraq to end its attacks on Iranian oil tankers, according to U.S. officials.

The administration argues that it must step up the U.S. presence in the gulf to keep open the oil-supply lines, to reassure Arab allies of U.S. reliability and to forestall an expanded Soviet presence there. In a speech last week, President Reagan said that if the United States does not provide protection to the Kuwaiti vessels, the Soviets will.

The inconsistencies and risks involved in what U.S. officials concede is a precedent-setting venture has sparked the toughest debate in Congress over U.S. Middle East policy since the administration's debacle in Lebanon between 1982 and 1984.

Once again, the same questions are being debated: whether U.S. military forces are in danger of "imminent hostilities" requiring the president to invoke the War Powers Resolution and whether the United States is not in fact committing its power and prestige to one side under other pretenses. Critics say the move represents a tilt toward Iraq, because Kuwait, a major financial backer of Iraq, is "neutral" in name only.

One member of Congress after another has reminded squirming administration witnesses how the United States plunged into Lebanon in August 1982 on the seemingly neutral and humanitarian pretext of protecting civilian Palestinian lives only to find itself committed to one side in the midst of a bitter Christian-Moslem power struggle.

The result was the loss of 257 U.S. servicemen, including 241 sleeping Marines blown up in their Beirut airport barracks in October 1983. In February 1984 the administration decided to abandon what it had repeatedly described as U.S. "strategic interests" in Lebanon as well as the Christian-dominated government of President Amin Gemayel.

The U.S. retreat from its commitments in Lebanon haunts not only the administration and Congress but the United States' Arab gulf allies as well. Before deciding how closely to associate themselves with the new U.S. effort, they are trying to decide whether Washington will again "cut and run" as it did in Lebanon.

"They fear the United States will retreat in face of casualties," said William Quandt, the Brookings Institution's senior Middle East analyst, who dubbed this fear "the Lebanon syndrome."

The unprovoked Iraqi attack May 17 on the USS Stark has already caused 37 American deaths and confirmed the worst fears of many members of Congress that the U.S. escort ships for reflagged Kuwaiti tankers could become "floating Marine barracks."

The Iranians have been bidding to heighten these fears. Friday, new Revolutionary Guard recruits leaving for the war front vowed to carry out suicide attacks against U.S. ships. A lone suicide Shiite driver drove a truckload of explosives into the U.S. Marine barracks.

In a heated exchange between Sen. John. F. Kerry (D-Mass.) and Sen. Rudy Boschwitz (R-Minn.) last week, Kerry remarked at one point, "This Congress does not want to repeat the mistakes he {Boschwitz} and others participated in with respect to Lebanon.

"We went into Lebanon with the understanding that we were escorting the PLO {Palestine Liberation Organization} out. That got translated into a status quo support of the Gemayel government, which ultimately resulted in the loss of Marine lives."

To many Democrats and Republicans alike, the parallels between the new escalating U.S. commitment in the gulf and the old U.S. engagement in Lebanon are multiple and unsettling.

Once again, the administration is arguing that "vital" and "strategic" U.S. interests are at stake and that America remains "neutral" despite its augmented presence in the midst of a bitter regional conflict in which one side, Iran, regards the United States as "the Great Satan."

As it did with Lebanon, the administration is telling a highly skeptical Congress there is no cause for invoking the 1973 War Powers Resolution because the gulf does not constitute a situation "where imminent involvement in hostilities is clearly indicated by the circumstances."

Reagan, in a letter to Congress in August 1982 as he was dispatching 800 Marines to Beirut, said, "I want to emphasize that there is no intention or expectation that U.S. armed forces will become involved in hostilities."

Defense Secretary Caspar W. Weinberger and Under Secretary of State Michael H. Armacost have been giving various congressional committees almost precisely the same assurances, emphasizing that the risk of confrontation with Iran is "low to moderate," the U.S. has no intention of "going to war" and there is no case to be made for "imminent hostilities."

With memories of Lebanon still alive, congressional critics have been challenging the administration's main arguments for escalating its military involvement in the gulf.

Others, Like Sens. John Glenn (D-Ohio) and Sam Nunn (D-Ga.), have charged that the administration's decision to allow U.S. flags on Kuwaiti ships has little to do with its much-vaunted concern for "freedom of the sea" and constitutes "a fictitious flagging" carried out so that the United States can "tilt" deliberately toward Iraq.

Glenn said he sees "nothing whatsoever wrong" with such a tilt but that the administration should declare its real intentions rather than pretending to remain neutral and hiding behind "the biggest fig leaf we've come up with yet" -- proposing to reflag Kuwaiti ships.

The administration's failure to make clear its real agenda in sending troops back to Beirut in late September 1982 later came to haunt it.

The declared rationale was purely humanitarian. The administration wanted to prevent further killing of Palestinian civilians by Israel-backed Lebanese Christians in the wake of the massacre by Christian militiamen of Palestinians in the Sabra and Chatila refugee camps in Beirut's southern suburbs.

But a little-noticed Sept. 25, 1982, agreement between the Gemayel government and the Reagan administration, providing 1,200 Marines as part of a four-nation Western peace-keeping force, also committed the United States to something far more: the restoration of the central, Christian-dominated government's authority over the Beirut area.

This commitment turned the United States into the main arms supplier and military trainer of the Christian-controlled Lebanese Army and eventually dragged the Reagan administration into renewed Lebanese sectarian strife on the Christian side.

In the gulf debate, the administration continues to refer to Kuwait as a "neutral" country and U.S. policy as one aimed strictly at defending the rights of "nonbelligerent" shipping in the gulf.

Technically, Kuwait is a nonbelligerent. But its billions of dollars in financial aid and diplomatic and logistical support to Iraq has made it a special target for hostile Iranian propaganda and Iranian-backed extremists who have carried out extensive sabotage inside Kuwait.

Iran also regards the administration's commitment to protect Kuwaiti tankers as nothing less than a U.S. plunge into the war on the side of Iraq.

Despite its uneasiness over the administration's decision, Congress seems to be aware that it has again been handed a fait accompli and placed "in a box" over what to do about it, as Kerry put it.

Boschwitz, in turn, had Democratic opponents of the administration's plan squirming last week.

"What kind of a hearing would we be having today," he asked Kerry, "if we had not become involved" and the Soviet Union had stepped in alone to help Kuwait.

"We would be having a hearing on whether or not we're giving away the Persian Gulf to the Russians and whether or not we shouldn't be interjecting ourselves and whether or not we shouldn't by carrying forward what a great maritime nation needs to do in these instances and become involved in protecting the open lanes of shipping around the world," said Boschwitz.

Fearing the prospect of a debate over "who lost the gulf to the Russians," the House and Senate Democratic leadership plan to meet Tuesday to discuss what position to take.

Rep. Les Aspin (D-Wis.), chairman of the House Armed Services Committee and a leading critic of the reflagging plan, suggested yesterday on CBS' "Face the Nation" that the Democrats may seek to impose a time limit on the U.S. reflagging of Kuwaiti ships and other conditions.

That is finally what Congress did in an attempt to limit the U.S. involvement in Lebanon. Over the administration's strenuous objections and 13 months after the arrival of 1,200 Marines in Lebanon, in September 1983 Congress passed a joint resolution stating that the U.S. forces were "now in hostilities requiring authorization of their continued presence under the War Powers Resolution."

The resolution authorized the president to keep the Marines there for an additional 18 months and required the president to report to Congress on the situation every 90 days.

Reagan signed the resolution but stated he did not recognize it as constitutional and insisted he retained his authority as commander in chief to deploy U.S. forces abroad. Informally, he agreed to report to Congress every 60 days.

The confrontation between the White House and Congress abruptly ended after Reagan announced on Feb. 7, 1984, that the Marines were being "redeployed" to ships off the Lebanese coast.