A little more than a year ago, banks large and small from Paris to San Francisco were lining up to loan money at slender profits to Mexico's booming, oil-fueled economy.

This week, Mexican officials are jetting around the industrialized world to many of those same banks for emergency cash to stave off bankruptcy. Now, the banks are reluctant to lend, even at the higher rates Mexico is forced to pay.

What went wrong?

Ironically, the very thing that sparked Mexico's boom in the late 1970s helped provoke its present financial crisis. The seeds of the crisis, most experts here believe, were sown in the collapse of the worldwide oil market last year, and the Mexican government's response to it.

Rather than cut back on its ambitious development plan -- predicated on the expectation of rising oil revenues -- the government of President Jose Lopez Portillo tried to prolong the Mexican boom last year at the cost of going ever deeper into debt.

The money went into efforts to keep the economy growing, decrease unemployment, keep down the cost of living and promote the ruling party's political popularity. Massive building projects from steel works to port facilities and a long-delayed nuclear power plant continued. Subsidies helped pay for a range of goods from tortillas (a subsidy estimated unofficially to cost $1.4 billion at the old exchange rate) to gasoline and other petroleum products (a subsidy recently estimated to be worth an astonishing 6 percent of the gross domestic product).

But as the world moved deeper into recession and oil prices stayed weak, these debts became more and more difficult to bear. Bankers in turn became uneasy about lending still more.

Mexico, like many developing countries, needs transfusions of foreign capital just to pay its import bills and service its foreign debt, now rising toward $80 billion. Once bankers lose confidence in a nation's ability to pay, their fears of bankruptcy can rapidly become self-fulfilling.

A government faced with the need to restore the financial community's faith often has few options but to do what its creditors want, almost regardless of the political costs.

"The Mexican president is a combination of the pope, the president and the queen," said one private sector economist. "Reality is the only thing that can stop him."

Now it has. The government has done the near-unthinkable of asking for a loan from the unpopular International Monetary Fund, in return for which it will undoubtedly have to agree to new, politically difficult austerity measures. The peso on the free market has plummeted to a value of less than one cent compared to more than four cents at the beginning of this year.

As the government confronted the need to raise prices and cut its spending dramatically, officials in Washington and Mexico moved swiftly to paper over the cracks of Mexico's insolvency and promised that with an IMF loan as a "keystone" an international rescue package for Mexico would soon be in place.

But this week it has become clear that beneath the official calm, there is still considerable concern: How easy will it be to persuade nervous bankers to give this country the money it needs? Will Mexico be able to reach agreement on an austerity package with the IMF? And how high a price in slowed growth, higher unemployment and falling living standards will Mexico's creditors exact for their agreement to bail it out?

It is critical for the United States, particularly, that the right balance is struck between pushing Mexico toward financial health and maintaining its political and social peace. It is equally important to the strained world banking system that a solution be found to the problems of one of its largest debtors.

The discovery of enormous oil reserves in the middle of the 1970s enabled Mexico to embark on a plan for rapid development.

The government aimed at an annual growth of 8 percent or more a year, increased public spending in all sectors from health and education to road building and port development, the expansion of private industry and agricultural production, and development of Mexico's vast oil wealth. Lopez Portillo promised jobs for Mexico's rapidly growing work force.

Foreign money flowed into the country, enticed by the prospect of steadily climbing oil revenues. Banks, with plenty of money to lend and few borrowers as apparently credit worthy as Mexico, accepted extremely small profits on their loans just to stay in the game. Backed by this foreign capital, investment and growth soared.

But as the economy grew rapidly, inflation began to accelerate. As it reached 30 percent last year while price increases slowed dramatically across the border in the United States, the balance of payments began to deteriorate sharply. After a 1980 deficit of $6.7 billion on the current account, which includes trade in both goods and services such as tourism, Mexico went $11.7 billion into the red last year, equivalent to a record 4.9 percent of gross national product.

While imports almost tripled in the three years up to 1981, exports other than petroleum grew by just 30 percent. Recession in the United States, the market for 56 percent of Mexico's exports, and depressed prices for many Mexican products -- such as copper, cocoa, gold and silver -- hurt. Tourism, traditionally a mainstay of Mexico's foreign exchange earnings, was hit by the overvalued peso, while Mexicans themselves spent more overseas.

Just when earnings from tourism, border transactions and manufactured exports were declining, the oil glut hit at Mexico's basic earning power.

In an attempt to hold onto Mexico's share of a declining world oil market, the then-director of the state-owned oil company, Jorge Diaz Serrano, announced a $4-a-barrel cut in oil prices in June of last year.

The oil czar's transparent political ambitions already had made him a controversial figure, and Lopez Portillo was quick to dismiss him after the politically unpalatable price cuts. But as the government tried to push oil prices back up, buyers began to back out of their contracts. Nervous Mexicans sent money out of the country in anticipation of a devaluation of the peso.

The new head of Pemex settled for a net cut of $2 in oil prices, and the government tightened control of imports, while Lopez Portillo vowed to defend the value of the peso "like a dog."

Foreign bankers still wanted to lend, but the money that flowed in was increasingly costly. Mexico was no longer able to dictate the terms of its borrowing to the banks and had to pay a higher premium for new money. Meanwhile, dollar interest rates, instead of falling as most experts had predicted, stayed at record heights.

Moreover, while the bankers were keen to enjoy the higher profits now available, they were less willing to commit money for a long period. In 1980 only 4 percent of the outstanding public debt was short-term money, according to a business analyst here. By 1981 this proportion rose to 12 percent, and in the first three months of this year it reached 13 percent.

Much of the new money went to finance still rising public spending, which jumped by 21 percent last year, after allowing for inflation. The public sector deficit reportedly climbed from 7.3 percent of gross domestic product in 1980 to 12.5 percent last year and was forecast to reach 15 percent this year.

Higher inflation added to the cost of the extensive price subsidies for a wide range of commodities and services that the government provides through numerous state agencies. One analyst estimated that the cost of these subsidies climbed by close to 40 percent last year.

Bankers now say that last year's growth could not be sustained much longer. Close ties between Mexico and the United States had made it easy for Mexicans to take their money out of the country whenever they felt their cash would be safer on deposit in New York or Houston than in Mexico City. Early this year, as hopes of a recovery in the United States dimmed, there was a further run on the peso, which forced the government to stop supporting it in February. The peso's value plunged by 40 percent.

The next six months were a disaster of mismanagement. Even Treasury Secretary Jesus Silva Herzog has conceded the government's policies were "erratic." Election-year politics meant that the government did not introduce any economic measures to back up the devaluation until it was too late.

After the devaluation, prices went up literally overnight. The commerce secretary announced a freeze on prices, but not until a week later. In March the government announced wage increases of up to 30 percent to compensate workers for the new higher prices, in the process wiping out much of the competitive boon from the devaluation.

Bankers and Mexican businessmen were horrified. By the time the newly appointed Silva Herzog introduced a 17-point austerity package in April, Mexico's creditors doubted that the cutback in public spending and decreased borrowing it called for would materialize.

Since then, the government has had to take harsher and harsher steps to reassure the financial community. But since they came piecemeal, no one step -- from doubling prices of tortillas and bread to letting the peso sink to below one cent -- was sufficient to restore confidence and stem the flow of money from the country.

Meanwhile, the first devaluation took a toll on the economy. Imports vital to production were cut back. Private companies that had contracted debts in dollars, now worth a total of about $22 billion, had to earn ever more pesos to pay them back. Many found themselves face to face with bankruptcy. When the largest industrial group in the country, Alfa, said it could no longer pay off its foreign creditors without an easing of its debt terms, it was clear that Mexico was in deep trouble.

International bankers putting together a new $2.5 billion jumbo loan to the government found few takers among small banks in June and were forced to put up most of the money themselves.

A growing number of bankers began to refuse to renew short-term government loans falling due. With only a few hundred million dollars left in its reserves, the government was finally forced this month to close the foreign exchanges, freeze the approximately $12 billion of U.S. currency deposited in Mexico and go for help to the international community.

Since then, the peso has plunged in value on the free market. Confusion reigns about who is entitled to the preferential dollar rate introduced earlier this month. New measures to deal with the crisis have been announced almost daily.

Officials are still scrambling to draft a detailed economic plan. Mexico's creditors--both private and government -- will expect a progress report from Silva Herzog when he flies to Toronto this week to the IMF-World Bank annual meeting.

The "symbiotic" relationship between commercial banks and heavy borrowers like Mexico means that an eventual agreement on stretching out Mexico's loan repayments is virtually assured.

"If you owe the bank $1,000 and you can't pay, you're in trouble. But if you owe it $1,000 million and you can't pay, the bank's in trouble too," commented one international banker last week in Mexico.

However, the banks with money at risk in Mexico range from the largest and most sophisticated international lenders in New York and London to border town banks unknown outside Texas and California. Negotiations that satisfy them all are likely to be tortuous and prolonged. They almost certainly will go on beyond the 90-day grace period for repayments of due loans already agreed in principle.

Mexico hopes to win the IMF seal of approval before that grace period expires. Only the IMF can insist on the kind of policy conditions that other creditors want, sources say, and once the IMF approves Mexico's policies, commercial banks probably would be satisfied.

Many experts agree that Mexico needs to reduce government spending and borrowing, to cut back its extensive controls on foreign imports, reduce its dependence on foreign borrowing and fight inflation, as the IMF is likely to request. But they also worry about how a halt to growth and job creation will affect the nation.

"One of the underlying concerns is that the Mexican government shouldn't be forced to put on the brakes so hard as to push social issues," one diplomat commented.

It is already clear that Mexicans face hard times this year and probably for some time to come.

"The economy has stopped," one private analyst said last week. In the first three months of this year industry scarcely grew at all, according to figures based on official data. Construction, a major source of employment bolstered by government projects, grew at an annual rate of only 2.4 percent between January and March, compared to 17.7 percent in the same months last year.

After this year's virtual stagnation, growth next year could be fueled by rapid growth in the United States, a sharp improvement in oil prices or demand, or a quick revival in world trade.

But none of these is thought to be in the cards, and many experts believe there will be little growth next year either. Meanwhile, the traditional engine of growth--public spending--is stalled.

Mexicans have agreed to spend less, although it is not clear whether the pain will hit the wealthy, many of whom benefit from endemic corruption here, as much as it will the bulk of the population, which faces an inflation rate of close to 100 percent this year.

The government has also mortgaged $1.3 billion of future oil production in exchange for emergency cash from the United States and Spain, and is seeking more deals of this sort. To U.S. delight, Mexico has agreed to raise oil production and exports. The latter are now running at about 1.7 million barrels per day compared to an "acceptable" target of 1.5 million last year.

Some foreigners would like Mexico to agree to relax controls on foreign investment that presently limit foreigners' control of Mexican companies. One banker here even suggested last week that the country should lease an oil field to the United States for 100 years in exchange for needed dollars. No government is likely to consider such a measure in this country where oil is the lifeblood of nationalism. The decision to go to the IMF was a sufficient blow to national pride.