When Iranian enthusiasts for Ayatollah Ruhollah Khomeini demonstrated in front of the State Department against the U.S.-Saudi alliance, they were unwittingly playing into a budding administration strategy to get $1 billion in proposed arms sales to Saudi Arabia through Congress.

The strategy involves portraying opponents of Saudi arms as being in bed with Tehran's terrorist regime. That poses a challenge for the pro-Israel lobby to repeat its feat earlier this year at the height of the Iran-contra probe when it blocked President Reagan's first attempt to sell F-15s and Maverick air-to-ground missiles to the Saudis. In fact, the American-Israel Public Affairs Committee may have trouble mobilizing the full Jewish community this time.

The stakes are high. A top-secret CIA analysis now under White House study reverses that agency's habitual pessimism about the Middle East, suggesting an upturn in Washington's long downhill slide with the moderate Arab world.

That results from American reflagging of Kuwaiti vessels and the U.S. naval presence in the Persian Gulf. But if Congress again vetoes the Saudi proposal, Soviet weapons will flood arsenals of moderate Arab states that for 40 years have depended on U.S. arms.

The White House wants to portray the sale not in pro-Arab or anti-Israel terms but, says a Reagan planner, as ''a policy for the best interests of all American citizens.'' What can put political meat on those rhetorical bones is symbolized by the pro-Khomeini demonstration at the State Department.

Placards featured Saudi Arabia and the American ''Great Satan'' joined as arch villains in last month's Mecca killings of Iranian pilgrims. The demonstrators left no room for doubt by carrying signs that read: ''No Arms for Saudi Arabia'' and ''U.S. Aggression-Saudi Oppression.''

The White House wants to link all foes of the Saudi arms package with the ayatollah's state-sponsored terrorism, including Hezbollah Shiites in Lebanon and their record of kidnapping Americans. ''AIPAC may not want to keep that kind of company,'' an administration official told us.

Actually, AIPAC is again committed to a congressional veto of Saudi arms. But that may not prove true of all major Jewish organizations and individual leaders of the American-Jewish community.

White House chief of staff Howard Baker and national security adviser Frank Carlucci invited a dozen Jewish leaders to an unreported chat in the White House and came away fairly optimistic. One Jewish leader present told us later that when the Saudi sale was brought up by Carlucci, the reaction was one of interest, not conflict. ''We want the total picture of Mideast arms,'' he said.

That total picture shows Israel strong and gaining, with nearly $2 billion of military aid coming in from U.S. taxpayers every year. But more telling to some Jewish leaders was the report to them of Saudi activity in the Gulf, much of it secret and some of it denied by the secretive kingdom to avoid stirring reactions from Arab extremists who hate the United States for its Israeli alliance.

A Saudi official, asked to explain whether a Saudi mine sweeper had been used to clear mines on a track exactly ahead of a U.S. Navy vessel, told reporters it was ''purely accidental.'' In truth, it was purely intentional, but the Saudis did not want to acknowledge it.

Similarly, the Saudi decision to patrol an AWACS radar plane over a new sector, far from Saudi Arabia and encompassing the Strait of Hormuz, is routinely denied by the kingdom. Such denials are exploited by AIPAC to convince Congress that the Saudis, though benefiting from the U.S. naval buildup in the Gulf, are unwilling to help.

Such examples of Saudi cooperation may be essential for the president to make the best case for his billion-dollar arms sale, no matter how the kingdom resists public disclosure. Another defeat in Congress would be read carefully by moderate Arab states.

Jordan, rejected for U.S. arms as Saudi Arabia has been, has quietly asked the Soviets for late-model MiG-29 fighters. Given the U.S. embargo, King Hussein would rather buy from Britain or France, but only Moscow or Washington can sell the arms on terms Jordan can afford. The congressional ban also has driven Kuwait to buy nearly $300 million worth from Moscow.

In an administration ideologically retreating on foreign and domestic fronts, victory on arms-to-Arabs after so many defeats would seem improbable. Optimism derives from the reaction by one Jewish leader who left the White House impressed by Saudi cooperation and uncomfortable about being in bed with the ayatollah.