Iran's Army -- once Shah Mohammad Reza Pahlavi's pride and joy and the arm of American power in the Middle East -- is sick, perhaps beyond recovery.

Empty barracks, more than half the officers and men gone, eight generals summarily executed, more than a dozen under death sentences and 215 retired; 20 jacked-up colonels named to divisional commands and key chief of staff jobs, looted armories and armed ragtag civilian militias -- such is a partial list of ailments.

"The armed forces are still in hospital on the critical list," a Western analyst said, "the best to be hoped for is a very slow convalescence with no notion of their being used for maintaining law and order for months."

Two weeks after the insurrection that shattered the once half-million-strong armed forces and swept the monarchy into the garbage can of history, the only clearcut winners are the Marxists.

"The Iranian Army was defenseless a week ago -- its arsenals emptied by revolutionary guerrillas and its commanders powerless to maintain discipline," Maj. Gen. Mohammed Vali Gharani, the recently appointed chief of staff, admitted at midweek. "I inherited an army that did not have a single soldier in Tehran."

If his estimate that half the armed forces is back in barracks is to be believed, the fact remains that the improvement is more apparent in the provinces than in Tehran itself.

The Marxist guerrillas, aware of the government's weakness now that it is deprived of a reliable military establishment, have consistently defied Ayatollah Ruhollah Khomeini's demands to hand in their looted weapons. At least 100,000 small arms disappeared from armories and arsenals in Tehran alone.

The guerrillas have become emboldened enough to deman a "people's army" with officers elected by the ranks, a technique aparently designed to seize power.

In the present power vacuum, some analysts believe the Marxists have made considerable inroads with American-trained air force technicians known as Homafara -- who played a key role in undermining military authority in the final weeks of the monarchy.

About the only source of heavily qualified optimism for the analysts is the impression that the armed forces have disintegrated rather than split. That distinction, though fine, is nonetheless crucial, for the analysts.

In time, patience and industry conceivably could rebuild the armed forces' unity, they reason, but a split in the ranks could lead only to civil war, as was the case in Lebanon in early 1976.

So aware is the Khomeini government of the longterm implications of any durable improvement in the armed forces that it has decided to establish a so-called Corps for the Protection of the Revolution.

The corps would put Khomeini's militiamen under military discipline and provide them with military, ideological and political education to confront the guerrillas if necessary.

Wholesale decapitation of the senior officer ranks is less a revolutionary act by the Khomeini camp than a realistic appraisal of the fact that the rank-and-file have rejected the leadership of the shah's generals.

For example, within a week of their appointments, the government's first choices to run the air force and police were ousted by pressure from the ranks.

Similarly, Gen. Gharani, head of an army made up largely of deserters, blandly acknowledged that four star and lieutenant generals were being retired en masse and that major generals would be eased out "gradually."

But two days later he announced that colonels would be taking over high command and staff jobs normally reserved for major generals, especially in the provinces, where colonels were appointed divisional commanders.

Gone with the wind, apparently were brigadier generals as well.

The potential damage inherent in such across-the-board retirements could be fatal. In the seniority-conscious Iranian armed forces traditionally only generals, and very senior generals at that, had any overall understanding and experience in running the show.

Although government ministers trumpet their faith in revolutionary colonels, analysts doubt the armed forces' ability to deal with any of the variations of the doomsday scenario pessimists have outlined for Iran in coming months.

The options vary from an armed showdown between Khomeini's followers and the Marxists, to secessions in historically independence-minded provinces such as Kurdestan, Azerbaijan and Baluchistan along Iran's borders.

The first stirrings of such upheaveals are clearly visible.

Mindful of such perils, the government has shown some signs of recognizing the advisibility of ending the executions of generals for fear that such summary retribution may persuade the now missing officers never to return to duty.

Further sources of demoralization are contained in reports that vigilante retribution -- or plain old settling of accounts -- has been responsible for arrests of junior officers and non-commissioned officers in the provinces.

In this light, the government's hints of supplying legions of volunteers to help the Palestine Liberation Organization deliver Israeli-occupied territories can only be seen in propaganda terms.

The shah's pretensions of playing gendarme in the oil-rich Persian Gulf had been abandoned even earlier during the ephemeral stewardship of Prime Minister Shapour Bakhtiar.

Before the revolution triumphed, severe cutbacks were in store for the military, largely because the country could no longer afford the enormous military budget.

Because of the political turmoil, observers doubt the new regime can count on draftees. who made up more than half the 285,000-man ground forces and have now deserted en masse.

Yet the government shows no signs of deviating from the old Middle East norm of wanting to keep a strong army.

Even the most anti-Western spokesman have stressed that the new Iran must not allow to rust the American-built F4 and F14 warplanes and Bell helicopters and the British-made Chieftain tanks.

As politically distasteful as it is, the new leadership is admitting in public that that entails the presence of British and especially American contract technicians, all of whom have been driven out in the present mood of xenophobia.

All this theory is fine But the nitty gritty is being fought out every night in Tehran, especially in the once fatcat northern sector where the Marxists are challenging the Khomeini forces for control of the key military installations, arsenals, power plants and communications.