Deep and possibly irreparable cracks are beginning to show in Ayatoliah Ruhollah Khomeini's iron-fisted theocracy. With increasing persistence, the question is being asked among Iran's secular society and among some of the most ardent supporters of the revolution against the monarchy: "How long can he last?"

Among the city's poor, the rural peasants and the wave of disillusioned migrants who streamed to Tehram in search of jobs during the last two decades, Khomeini continues to enjoy solid - but no longer unquestioned - support.Still the revered revolutionary hero, he is riding high on expectations that, while unfulfilled, have not been abandoned.

But among the increasingly restive middle class, the educated and politically conscious segment of Iran's society, discontent is widespread and growing. This was their revolution, too, but they have become alienated from it and embittered by their conclusion that they have traded one dictator who tried to move Iran forward at dizzying speed for another fictator who is trying to move it backward just as fast.

Barely six months after his triumphant return from exile, when he inspired a ragtag collection of determined street fighters to force the capitulation of one of the world's biggest and best equipped armies, Khomeini is presiding over a country that teeters on the brink of chaos again.

Iran's historically restive ethnic minorities - the Kurds and Turkomans in the north, the Arabs in the south-west and the Baluchis in the southeast - are becoming increasingly rebellious. The provisional government of Prime

The threat of a civil war, sparked by the minorities and fueled by leftist groups that nominally aligned themselves with the religious forces to overthrow the shah, is real and conceivably could bring to Iran continuing strife and instability as in Lebanon.

Apart from the minorities, intense rivalries for power have beset Iran from the first day of the Islamic Republic, with members of the clergy creating their own power bases and ad hoc revolutionary committees komitehs becoming so deeply entrenched that the central government is afraid to challenge their edicts, much less suggest that they be disbanded.

The army, shattered and humiliated by its ignominious defeat at the hands of the revolutionaries, remains in a shambles at a fraction of the strength of the shah's inflated armed forces and half the numbers the revolutionary military command says it should have. Some Western military analysts believe the Islamic republic's army would be impotent in the event of a border challenge or coordinated insurrection by enthnic minorities.

The economy of Iran is on the verge of collapse, held together only by still sizable oil revenues and those industries built up by the shah that are still operating.

Industrial production, excluding oil, is no more than half of what it was before the revolution, and at least 50 percent of the work force is either unemployed or so seriously underemployed that, as far as productivity is concerned, it might as well be jobless, according to the estimates of several independent economic analysts.

But at first brush, Iran has the deceptive appearance of normalcy. To a visitor returning for the first time since witnessing the tumultous events of January and February, there was a striking change in the atmosphere of the country.

Traffic in Tehran is still madcap and anarchic - as it always has been - but the city functions remarkably well given the wrenching experience of the last year. Garbage is collected, parks are watered and maintained, shops and offices are open and doing brisk business and electrical power flows uninterrupted, although Khomeini critics are keen to point out that if industries were not virtually shut down, power blackouts would be as common as ever.

The young, sullen gunmen who prowled the streets with automatic rifles they barely knew how to use, intimidating strangers in the name of the revolution, are gone, for the most part.

Gone also - or at least diminishing - is the galloping xenophobia that used to be encountered everywhere. If smiled at by a foreigner, most Iranians now smile back, and the tension of the immediate postrevolution days has given way to something approaching friendliness by Iranians of ordinary walks of life.

Even Americans, the prime target of seething rage during and immediately after the upheaval, generally are regarded by Iranians with more curiosity than hostility. It is not uncommon in the midst of a fervent political rally to be engaged in friendly conversation and then be surrounded by scores of curious passersby.

But beneath the surface of the appearance of normalcy there is a troubled Iran, facing the uncertainty of the future with deep internal divisions and led by men who cannot seem to agree on who is in charge.

Examples of autocracy are abundant in Iran today. With the tacit approval of the Khomeini leadership frenzied mobs burn bookstalls selling leftist opposition tracts and intimidate the staffs of even the biggest Persian newspapers; the government monitors telex and telephone lines; single women in some government ministries have been warned they will be given medical examinations to prove their virginity; Khomeini bans all music from radio and television; people are flogged for kissing in public or sent before firing squards for engaging in prostitution or adultery and Iranians and foreigners alike are prohibited from taking Persian carpets out of the country.

By the same token, examples of Iranians ignoring Khomeini's theocracy also abound:

Corruption is widespread among members of the revolutionary committees some of whose members covertly sell liquor and take bribes for official favors; motorists drive around town with cassette tape players blaring Western rock music in defiance of Khomeini's ban; leftist groups demonstrate openly against the government and underground newspapers question Khomeini's faithulness to the revolution.

Disparaging and even off-color remarks about the ayatollah are not uncommon, and defaced posters of the 79-year-old bearded leader can occasionally be seen.

"Just give him enough time to show the people his weaknesses, and we will be rid of him," a yound, attractively-dressed secretary says of Khomeini, albeit well out of earshot of anyone she does not know.

When Khomeini and his trusted aides stepped out of an Air France 747 jetliner from Paris in February and began putting together a government, they used a time-tested process to create a provisional body that would perform a housekeeping function in the absence of elected leaders.

But several things interfered with that goal. The new, inexperienced leaders underestimated the complexity of drafting a constitution and getting it approved with the semblance of a democratic process and their first fumbling and near panicky effort created the distinct impression of autocracy and incompetence in the first months of the new government.

Also, as a result of the suddenness of their almost accidental victory over the shah and the overnight collapse of Iran's administrative and security structure hastily assembled substitutes stepped into the vacuum and instantly created rivals to the provisional government.

The revolutionary committees, formed to temporarily run mundane local affairs - everthing form settling family disputes to operating municipal services - grew in power and quickly became resentful of provisional government interference. The revolutionary courts, originally formed to administer speedy justice to "criminals" of the shah's government, now exert control on cases of all kinds.

The secret Revolutionary Council Khomeini's umbrella ploicy-making committee, found itself at odds with Bazargan's shaky provisional government and began working around it intead fo with it.

Now, there is evidence that the beleaguered Islamic leadership is attempting to get back on its original track, trying to elect a constitutional assembly of experts next month, complete the charter by early September and hold elections by early October.

Khomeini seems to have come to the conclusion that because of the government's inability to cope with the informal structure, an elected government is more necessary than ever. he also appears to be convinced that an elected government will succeed where the provisional government has failed.

But among many observers, even some in the government, there are serious doubts whether it is not too late.

"The komitehs are tow will entrenched. The government can't suddenly take power away from them and say, 'thanks for your time. We'll take over from here," said and experienced Western diplomat who has been here since the beginning of the revolution last year.

"How the government will cope with that depends whether the armed forced can be reconstituted and the police revived,' he said. He noted that the police now are mostly without arms and under the influence of the komithehs , which have occupied station houses.

There appear to be several possibilities for Iran's future. One is unchecked civil war, led by the ethcic minorities and compounded by a bid for power by some or all of the leftist guerrilla groups still intact after helping to overthrow the shah.

These groups feel betrayed by the new government after having participated in the rebellion.

A spokesman for the Marxist-Leninist Fedaye Khalq, complaining that Khomeini has compromised with imperialists and that the revolution has failed, said, "There obviously will be a new uprising, but I don't know when. It's started in a small way, but the atmosphere isn't right for a general protest yet."

A civil war here probably would begin with indeterminate skirmishing some analysts believe, not unlike China in the 1920s.

Another possibility is a coup d'etat by the right wing - possibly the military or even elements within Khomeini's own camp.

Recognizing that posibility, the new government's first defense minister, Rear Adm.Ahmad Madani, who now is governor general of Khuzestan province, said he would encourage a defense establishment "with civilians making policy and generals executing tactics. We must not have a few strong men at the top commanding many (law-ranking) officers and men. There must be a gradual curve of control as in the United States, the United Kingdom and other countries were coup d'etats are unheard of."

Madani said an optimum-sized armed forced would be about 150,000 plus a national guard of about 100,000 a third of the size of the shah's active and reserve forces.

The most likely propect for Iran appears to be a gradual fragmentation of the government, followed possibly by renewed violence and another period of political instablitity. More remote is the possibility of a takeover by a strong leader either from the left or the right.

What augers against a rapid decline in Khomeini's power is Iran's big cushion of oil money which, although much of it is tied up in foreign exchange reserves, provides a dole to keep feeding the idle and paying non-productive work forces, thereby retarding the process of disillusionment.

Historically, such leisurely fragmentation in Iran has always seemed to point to a conflagration, but it always has been reversed by the imposition of a strong central authority, usually a dictatorship.

"The problem is, there is so little discipline in Iran and so little respect for leaders," said a diplomat. "The workers have demonstrated to themselves that they can successfully pull off a revolution. So. if they become disenchanted with the way things are going, what's to stop them from doing it again?"