Ayatollah Ruhollah Khomeini's call for a jihad -- an uprising of all Moslems against those who threaten Islam -- has put other nations with large Islamic populations in a dangerous position as many try to balance their political priorities with religious passion.

Diplomats surveyed in Washington and at United Nations missions agreed overwhelmingly that their primary concern in the U.S.-Iranian conflict is to stay out of it.

Yet most recognized that Khomeini's charge of U.S. involvement in the attack on Mecca's holy shrine, repeated again yesterday, and his call to "Moslems of the world" to "stand up (and) invoke the might of God and defend Islamic and national aspirations," strike an emotional nerve extending far beyond the Iranian-based Shiite sect that Khomeini leads.

"This is one aspect of Khomeini, whether we like it or not," said one Middle Eastern diplomat. "You can't take in isolation what happened in Pakistan or Turkey," where angry mobs, primarily non-Shiites, attacked U.S. installations.

"We can see the whole area affected," he said. It can't be confined to one sect."

Khomeini's call, added a North African diplomat, "will be heard all over the Moslem world. I can imagine very easily, as soon as any part of Mecca is touched, an explosion of passion. Islam is a very deep-going faith . . . and the whole atmosphere could become a question of 'Is he a Moslem or not?'"

The diplomats believe neither the Carter administration nor the U.S. media is helping to contain the situation.

While few Moslem-majority nations consider themselves direct allies of the United States, and some would publicly describe themselves as opponents, most -- from Malaysia to Kuwait and Algeria -- are tied to Washington by complex financial or political webs.

But the diplomats resent U.S. efforts to solicit their open support in a conflict that many say was of Washington's making, first through its close identification with the deposed shah of Iran, and later with its decision to allow him to enter the United States.

"The United States invited trouble," said the ambassador of a Middle East country whose relations with Washington traditionally have been cordial. e"Don't think we'll come out in public support. Why us? What about your own allies" in Western Europe?

As the diplomats try to separate their domestic religious affiliations from relations with Washington, they say the United States has gone out of its way to single them out for broadbrush identification as "Moslem nations."

One cause of irritation reflected by representatives of a number of nations was Secretary of State Cyrus Vance's call for a meeting last Wednesday with "Moslem ambassadors" of approximately 30 countries.

The ostensible purpose was to ask for additional security at U.S embassies and diplomatic installations in their countries.

"Your embassy will be well proteced," said one ambassador. "At least, I'm keeping my fingers crossed." But by publicly singling these nations out, he said, "you're causing the ordinary U.S. layman to believe we are all against you.

"Your media is making a war. They don't say 'Iranian demonstrators' or 'Turkish rioters,' they say 'Moslem mobs' and 'militant Moslems.'"

Yet most of the diplomats willing to comment agreed that the across-border identificatin of all Islam as one was precisely what Khomeini was appealing to.

Although Khomeini has not used the word "jihad" in his speeches, several diplomats agreed that his phrasing set the conditions for a holy war.

"A jihad is not an easy thing," the North African said. "It is called for when there is a threat to annihilate the personality of Islam, when the root of Islam is in danger from blasphemy or infidels."

In his speech Thursday to visiting Pakistani military officers, Khomeini described the conflict with the United States as one between "blasphemy and Islam," and called on Moslems to "arise, face up to the fight and become victorious."

Moslems, he said, must "be one and not separate from each other . . . not consider frontiers as the cause of dividing their hearts . . . They don't need any country."

Yesterday, as he again accused the United States and "its stooge, Israel," of attacking the mosque at Mecca, Khomeini charged Moslems with being "indifferent. You should rise and defend the holy shrine."

The diplomats pointed out that Khomeni, "with all due respect," as one put it, is merely "one religious authority of the Shiite sect, a small part of Moslems as a whole that comprises about 10 or 15 percent of Islam."

Apart from Iran and Iraq, few countries have majority Shiite populations.

Several have significant Shiite minorities and in others, in regions like north and central Africa and the Far East, membership in the sect is negligible. In addition, many of those countries with Moslem majorities, such as Turkey, have established secular states in which government theoretically has nothing to do with religion.

But several of the diplomats saw Khomeini's appeals as the beginning of a new phase of Moslem activism. "It may not be something conspicuous," said one, "but it will psychologically mold the whole area. It has nothing to do with governments."

Some nations, particularly among the Arab states, fear that for political as well as religious reasons, they will be unable to avoid being drawn into a direct confrontation between Iran and the United States.