AYATOLLAH KHOMEINI'S return from 14 years of exile was a remarkable triumph for him had his millions of followers. His leadership and their compelling and largely unarmed resistance had expelled the shah last month, and last week the combination forced the prime minister named by the shah, Shahpour Bakhtiar, to allow Mr. Khomeini to pursue his drive for an "Islamic republic" on home soil. His return at once sharpened an already acute struggle for power involving other religious leaders with their own notions of Iran's future, Mr. Bakhtiar and his supporters and rivals among the civilian politicians, and an army of uncertain cohesion and loyalty. Will Iran be reborn under a civilian-run polity guided from above by Mr. Khomeini, as he intends, or will it proceed through further chaos and violence to some other station? The bargaining, some of it openly menacing, some of it furtively manipulative, is on.

Upon setting foot in Tehran, Mr. Khomeini uttered some words subject to being understood as a dire physical threat -- cutting off hands -- to the 8,500 Americans remaining in Iran. His supporters suggesttionalistic passion against the foreign influences they blame for sustaining the shah. It is so that, through a year of protests, only two Americans have been killed. It would be a grave misfortune if Americans how became the targets of the mob. The United States would have to do what was necessary to protect them. The political effects would be severe, not to mention the potential military risks.

There is the further immediate question of the Iranian military gear of American origin and of the American intelligence equipment used to monitor Soviet missile tests. The materiel in question is in Iran under agreements that any duly constituted government in Iran is bound to honor. Mr. Khomeini's entourage insists he is devotedly anti-Soviet and anticommunist and would not let hostile powers or their agents take advantage of the Iranian revolution. What happens to the materiel will be an important test.

The administration, previously a veritable chatterbox on Iranian politics, has fallen uncharacteristically and wisely silent now that Mr. Khomeini is home. It appears to feel that long-distance political jiggling is too uncertain and dangerous. Instead, officials are letting it be known that the United States is ready to resume friendly relations with any successor government. Such official dealings as the United States has with Iran these days can only be with the existing government of Mr. Bakhtiar. Recognition of it, however, is not endorsement.

The solution in Tehran will be an Iranian one. it is important that Iranians and others see it as Iranian. The United States has no choice but to make a virtue of necessity, to stay clear of the turbulence, and to make the best of whatever the result is.