The dilemma President Carter and his advisers face in the long siege in Iran is that they have been forced to rely upon diplomatic machinery to deal with a crisis that is not inherently diplomatic.

It is a crisis ignited more by Iran's internal politics than by internaltional policies, many American officials have come to believe. And they now say that the fate of the hostages in the U.S. Embassy in Tehran may hinge upon a domestic event in Iran this Sunday and Monday -- a public referedum on the Ayatollah Ruhollah Khomeini's new constitution.

Carter's advisers have come to believe that the expected overwhelming approval of this constitution may do more to alter the siege in Iran than any escalated diplomatic pressures or strategies they can conjure.

The administration officials say the crisis will take on a new form after the referendium, with a new ruling authority that soon will be in place and prepared to make decisions. This, they say, may make a diplomatic solution possible at last.

As administration officials now see it, the current siege cannot be understood without considering the ayatollah's domestic political crisis in Iran. The plight of the hostages today may well have its roots in the ayatollah's battle to win the hearts and minds of his people.

It is an internal battle that began with his arrival to power after the shah was deposed. And this battle, at least, may be eased Sunday and Monday, when the ayatollah is expected to win overwhelming public ratification of the new Iranian constitution he has sought and shaped, a ratification he has apparently been building toward in months of carefully constructed manipulation of public support and emotion.

Some administration officials believe the Americans working in the U.S. Embassy in Tehran may have fallen victim, most of all , to effort of the ayatollah aimed at marshaling support for his revolution, which has been floundering in its own disorder.

For they believe the current siege at the embassy may have its roots in a bizarre confluence of events, beginning many months ago.

In February, Khomeini faced the end of one revolution but the onset of another: a struggle to build a consensus out of chaos and to shape the Islamic state he had sought during his many years in exile.

The ayatollah sought to fashion an idealized, almost platonic, Islamic state out of the remains of a nation the shah had been forcing headlong into modernization, with human rights taking a back seat to personal power and national progress.

After Mohammad Reza Pahlavi, the shah, was deposed, Iranian leaders plunged into a prolonged debate over what their new constitution would look like. In July, a draft constition was produced similar to the 1906 constitution, which had been in place in Iran and had been modeled after a Belgain document.

The ayatollah approved the publication of this draft constitution. But, since he wanted to move further toward an Islamic state, he did not endorse the document. Instead, he proudly convened a council of experts to review the draft constitution, stacking the council with hand-picked members.

Council members were elected publicly, but the turnout was slight.

The ayatollah moved swiftly to marshal public support. He also mounted a series of public attacks on the Kurds, identifying them as enemies of the revolution, and began a crackdown. He named himself commander-in-chief.

Meanwhile, as American officials have analyzed it, the ayatollah's council of experts was performing major alterations on the draft constitution, inserting a more heavily Islamic orientation. The final document would make Khomeini Iran's leader for life, and would give him virtual veto over all legislation.

By late October, with the new constitution almost completed, there was growing concern in secular factions of the Iranian leadership.Then-prime minister Mehdi Barzagan and others submitted a petition to Khomeini calling for the disbanding of the council of experts, on the grounds that it had exceeded its mandate.

Up until then, ayatollah had been building support internally by attacking the Kurda, the Americans and even the Soviets as enemies of his Islamic revolution. But as Barzagan went to Algiers for the celebration of the 25th anniversary of the Algerian revolution (he met with Carter adviser Zbigniew Brzezinski while there), the ayatollah had turned his rhetoric into hard-line anti-American.

It is against the backdrop of all of this internal dissension and jockeying in Iran, many U.S. officials believe that the entrance of the shah into the United States be viewed. With former secretary of state Henry A. Kissinger and one of his long-standing benefactors, David Rockefeller, acting as lobbyists for the deposed shah, the Carter administration agreed to switch its policy and allow the shah to enter the United States of treatment of cancer.

Since the shah was deposed, he has been in Egypt, Moroco, the Bahamas and Mexico, without mobs in Iran taking internaitonal law into their own hands to demand his return. But when the shah came to the United States, the the mob of self-acclaimed students overran the U.S. Embassy -- with the support of Khomeini, as eventually became clear.

The United States and the hospitalized shah were targets of opportunity for the ayatollah, administration officials have now concluded. This became the emotionaly powerful rallying point for the ayatollah, whose administration has had major economic problems and high unemployment.

A third factor has also come into the situation, and once again it is the sort of emotionally galvanizing event that could he helpful to the ayatollah. the country is building toward the peak of its 10-day holiday, celebrating the end of the 1,500 years on the Islamic lunar calender. The holiday will end in a wave of public emotion Saturday, the day before the ayatollah has scheduled his public referendum on the consititution.

Taken together, the nationalistic crest of anti-shah and anti-American fervor plus the emotion of the religious holiday should guarantee Khomeini his overwhelming referendum of approval, American officials say.

They see the referendum as the most significent event in the Iranian revolution since the shah was deposited in February. It is an event, they say, that will change the situation in Iran, and which may offer hope for a peaceful conclusion to the siege at the U.S. Embassy in Tehran.