The overwhelming House and Senate rejection this week of President Reagan's arms sale to Saudi Arabia has exposed what administration officials fear is a reservoir of pent-up, anti-Arab feeling in Congress that could engulf 30 years of U.S. efforts to maintain close ties with moderate Arab states.

"The rhetoric on Capitol Hill this week was frightening," one State Department official said yesterday of the debates that preceded the votes in the Senate Tuesday and the House Wednesday. "Many members were quite blatant in making clear that they didn't consider the sale a threat to Israel or to U.S. interests. Instead they were using Saudi Arabia to express their frustration with the entire Arab world."

Administration and congressional sources agree that this frustration resulted from a buildup of many factors: the plunging price of oil that has lessened U.S. dependence on Arab producers like Saudi Arabia; anger at the reluctance of Arab leaders to control the Palestine Liberation Organization and move toward peace talks with Israel; and, most importantly, the belief that the Arab world is the chief source of international terrorism.

Many lawmakers justified their votes as consistent with Reagan's fierce antiterrorist rhetoric and his use of military force to deter Libya's support of terrorism. Speaker after speaker in both houses assailed Saudi Arabia's financial backing for groups such as the PLO and Saudi condemnation of last month's U.S. air strike against Libya.

As Sen. Alan Cranston (D-Calif.) put it Tuesday, "We want to make it clear that it is not in the national interests of the United States to sell advanced weapons to nations that consistently scorn U.S. interests."

Others in Congress, including Sen. Charles McC. Mathias Jr. (R-Md.), lay much of the blame for the overwhelming defeat on White House reluctance to lobby actively for the measure. "If the president isn't going to lead, you're not going to find the members of Congress looking for trouble, particularly in an election year," Mathias said.

In the end, what the administration originally regarded as a relatively innocuous arms sale -- one that drew only token opposition from Israel and the principal pro-Israeli lobbying group, the American Israel Public Affairs Committee -- was voted down by margins so lopsided that there is doubt about Reagan's ability to rescue the sale through a veto of the congressional action.

The administration's principal argument for the sale is that "U.S. interests are best served by continued strong and credible relations with moderate Arabs," as Richard W. Murphy, the assistant secretary of state who carried the main burden of arguing the need for the Saudi sale, put it.

"We face a time of testing whether the successful policy of 30 years is relevant," Murphy said, "or if we will turn around and pursue a more parochial, narrow and extremist policy."

For years, successive administrations have managed to sway Congress with that argument. But, in recent months, attempts to wield it on behalf of the Saudi sale and an earlier proposed arms sale to Jordan have foundered against the new mood that appears to be sweeping Capitol Hill.

"There's no question that there is a sense of discouragement about the Middle East -- that we've put a lot of effort and money into cultivating the moderate Arabs and that we've been burned," Rep. Lee H. Hamilton (D-Ind.), chairman of the House Foreign Affairs subcommittee on Europe and the Middle East and a supporter of the Saudi sale, said yesterday. "Things are not improving there; they're moving backward, and that makes members of Congress want to be less involved with the region."

A senior Senate staff member, who asked not to be identified, noted: "Congress is reflecting a general attitude in the country that U.S.-Arab relations are less important than in the past. People feel that the peace between Israel and Egypt has lessened the danger of war. They feel that the fall in oil prices has freed the American economy from what they regarded as Arab price gouging and blackmail. When you add the terrorism factor, the situation is a natural one for an ethnocentric reaction."

Former senator James Abourezk (D-S.D.), head of the Arab American Anti-Discrimination Committee, said he believes the vote was symptomatic of "an incredible buildup of racist feeling that has been made respectable by Reagan's rhetoric that equates terrorism with Arabs. It even threatens Arab Americans, and I only hope it doesn't lead to internment camps like we had for Japanese Americans during World War II."

Mathias and others say they believe such concern is greatly exaggerated, but Mathias suggested that "there is a drift and lack of clarity about our Middle East policy that allowed ignorance to override a real understanding of the dynamic of events in the region and how they affect our interests."

Consequently, according to one State Department official, "Murphy was preaching to the deaf with his explanations about how factors like Arab solidarity prevent Saudi Arabia or Jordan from supporting American attacks on [Libyan leader Muammar] Qaddafi. To people in Congress, Murphy came across as just another State Department Arabist giving rationalizations and excuses that they don't want to hear at this point in time."

It remains unclear how Saudi Arabia and other Arab nations friendly to the United States will respond, but the State Department official predicted that "the moderate Arabs will throw up their hands and question whether the United States is a credible and reliable friend. What does that do to help our efforts to influence an end to the Arab-Israeli conflict or to have the Arabs turn to us if there is a widening of the Iran-Iraq war or some other event that could create a new energy crisis?