Like many other countries that have fought a war, Iran is learning about food lines, rationing, the black market, refugees, inflation and generally hard times.

The situation has been compounded in Iran's case by the revolutionary turmoil and, later, American-directed sanctions that weakened the once-flourishing oil-fed economy in the two years preceding Iraq's invasion in September 1980.

Still largely obscured in the nationalist pride of wartime sacrifice--which is shared by the ruling clerical class and Iranians who often are at loggerheads on other issues--is the fact that, whatever the revolution's other accomplishments, managing the economy is not yet one of them. Nor is a practical plan for future development.

The Planning and Budget Ministry recently published what amounted to a compendium of hopes listing various ministries' pet projects but without any hierarchy of priorities or sense of organization.

So far Ayatollah Ruhollah Khomeini's exhortations for economic self-sufficiency have gone largely unheeded except, as one Iranian noted, regarding production of illegal vodka.

Although the United States and the late shah, Mohammad Reza Pahlavi, have been blamed for the economic mess, many members of the clergy believe that the current material deprivation is a virtue for those Iranians who enjoyed under the shah a U.S.-style consumer society, which now is fast becoming a fading memory.

There are 3 million to 4 million unemployed out of the once 10 million-strong work force, and more than a million war refugees have fled from the Khuzestan combat zone. Tehran's population, which the revolutionaries had hoped to reduce, has risen from 4 million to 7 million residents.

Some observers feared the economy was close to collapse late last year and worried about a heatless winter in addition to shortages of food and medicine.

But sources insist that the worst threat--that the economic crisis would lead to civil disorder--has at least temporarily subsided with the arrival of warmer spring weather and fresh fruit and vegetables on the market.

Two jokes typify a souring popular mood here.

In the first, an old man explains his admiration for the revolution to a jaded and disbelieving friend. "Yes," he enthuses, "I have three sons and they're all employed--one is waiting in line for gasoline, the second queues for bread and the third for meat. Soon they'll be getting overtime."

The second is a variation on the traditional jokes about Rasht, a northern city whose women are reputed to be of easy virtue and whose men are depicted as simpletons.

"Things are so tough that you need a ration coupon to make love to your wife," the joke goes, "and in Rasht everyone is selling their coupons."

Iran's wartime problems became acute last summer with the partial collapse of oil prices and a rush of uncontrolled imports amounting to $1.5 billion a month from mid-March to mid-October 1981.

The resulting deficit eroded foreign exchange reserves which, as of April 1, 1981, the central bank had said stood at $4 billion backed by $3 billion in gold.

A run on the bank effectively ensued when foreign exchange earnings appeared to have dipped to $500,000 last fall. Rumors circulated that the central bank had begun to sell off gold and to unsuccessfully seek a loan from Japanese, Swiss and West German banks. Official denials did little to allay such suspicions, nor did the Central Bank's listing of foreign exchange reserves at $2 billion.

All this underlined the precariousness of waging war during an oil glut. Iran must pay cash and has not benefited from the massive outside aid that has kept the economy of Iraq looking healthy thanks to a $24 billion transfusion from Saudi Arabia, Kuwait, Qatar and the United Arab Emirates.

Iran's switch after the revolution to short-term oil contracts and the volatile spot market backfired in mid-1981 when falling oil prices hit unstable sources of supply like Tehran.

Iranian exports fell from 900,000 barrels a day to perhaps 400,000 barrels a day by September as customers spurned Iran's $37 per barrel light crude.

During the winter, exports climbed back to 700,000 barrels a day and perhaps even close to the million-barrel mark.

But Iran, at one time a price hawk, has been obliged to slice prices five times since February to $30.20 a barrel, undercutting the Oranization of Petroleum Exporting Countries' marker price of $34 a barrel. So much of Iran's oil is sold on the spot market at around $26 a barrel that local specialists calculate that the average price for all Iranian sales is $28 a barrel.

The oil glut and the war have also forced Iran into barter deals swapping oil for goods with countries short of hard currency like Turkey, as well as other Third World nations and, particularly, nations of the Soviet Bloc.

As a result, Iran's foreign trade, once overwhelmingly conducted with the West and Japan, now reflects its announced ideological preference for "neither East nor West."

Soviet Bloc countries have increased their market share from 7 percent of the Iranian market before the revolution to 11 percent today.

These inroads, however are limited by the high technology in Iran's existing industrial plant, most of which was bought from the West.

Western diplomats mutter about highly placed members of the pro-Moscow communist Tudeh Party in the Foreign Trade Ministry--numbering 30 percent of the personnel, according to some accounts--who make a practice of reopening tenders to allow Soviet Bloc bidders to jump in.

But with the majority of the estimated $225 million monthly foreign exchange earnings earmarked for war purchases and the rest spent on food imports, Iran has little choice of trading partners.

Western companies are largely uninterested in accepting the proffered oil that the Iranians want to use to pay for imports.

Although a low level of crude production was a revolutionary tenet of the country's Islamic government from its earliest days, specialists are convinced that Iran would raise its production to 2.5 to 3 million barrels a day--a figure still less than half of prerevolutionary production--if buyers could be found.

For the time being, the authorities appear to have turned a blind eye to what Iranians call "the open black market," which is said to be tolerated and sometimes even indirectly operated by official organs and their affiliates.

The mosques or the often mosque-run Komitehs--parallel policing authorities, which sprang up during the revolution--began issuing ration books through Islamic cooperatives when Iraq invaded Iran in September 1980.

The ration coupons do not guarantee supplies to holders. They instead limit the amount that can be purchased of various goods--including gasoline, kerosene, rice, sugar, cooking oil, milk, eggs and chicken--if the goods can be found at the fixed price at all.

Designed in theory to insulate the poor from inflation, now running at double the officially admitted 30 percent, the rationing system is meant to supply working class south Tehran more generously than the prosperous north end of the capital.

But even in the south, men and women wait patiently for hours in segregated lines in hope of finding food at guaranteed prices. The wealthier have long since taken to paying more to eat well, spending as much as $8 a pound for boned lamb, for example--up 80 percent in a single year.

Although private motorists are limited to just over 10 gallons of gasoline a month, extra supplies are openly available for those willing to pay almost twice the $1.84 official price per gallon.

The street sales of U.S.-brand cigarettes, which before the revolution sold for $1 a pack and now cost $5.50, are widely believed to be run by the Revolutionary Guards as one of their several lucrative sidelines.

The mosques, which keep detailed files on neighborhood residents, regularly dispense favors for a consideration, according to Tehran residents.

"You need a fridge? You don't want to wait six months," an Iranian explained, "so you go see the mullah and he bumps you up 30 places. Your messenger needs a motorbike--the mullah is the man to find you one without waiting interminably. It's just a question of cash."