Three years ago with their foreign reserves in the red and the national economy on the edge of bankruptcy, Peruvian officials turned to the international banking community and did some very serious bargaining.

Some of their deals were bitterly attacked on the home front, but the Peruvian leaders got what they wanted: the International Monetary Fund put up a $300 million emergency standby credit, in exchange for a Peruvian austerity program that cut wages and public spending, laid off government employes, devalued the Peruvian sol, cut back on plans for more foreign debt and dropped and subsides on food and gasoline.

Public and private bankers, after listening to the Peruvians present their case, agreed to give them two years' relief from the total $1.6 billion debt that was coming due in 1979 and 1980. For the next two years, the bankers agreed, the Peruvians would have to pay back only 10 percent per year of the massive obligation.

By 1980, the Peruvians had startled almost everyone concerned by jumping the deadline on their own debt. Convincing their creditors to forgo millions of dollars in interest and commissions, the Peruvians waived one full year of their debt relief and paid up early. For the Paris Club, the organization of governments and lending agencies that had helped arrange Peru's rollovers, the prepayment may have been a worldwide first, according to a foreign economist here.

Now, however, the prospect is once again one of huge, new debt -- the latest twist in the troubled spiral common to Peru and so many other developing countries.

Late last month, in a highly publicized meeting that took Peru's finance minister and most of his high-level economic colleagues overseas, the Peruvians were back at another Paris meeting of international lenders -- this time with the Peruvians asking for billions of dollars of new loans. To an interested and reportedly favorable reception, the Peruvians presented their proposal for a massive public works program that in cost and scope in unprecedented in the nation's recent history.

At a cost of $4.3 billion -- ultimately to grow to twice that amount -- the Peruvians want to build a vast collection of roads, and sewage systems for isolated towns in the countryside. They want expanded universities and 221,400 new telephone lines. They want new oil pumping stations, new and more modernized mines, new schools and rural hospitals, a new anthropoligical museum, and telephone communications in the jungle highlands.

"Peru is very sound from an economic point of view," said President Fernando Belaunde Terry. "We are very careful about the kind of investment we are doing . . . . If it is a hydroelectric plant, you will sell electricity."

The preliminary reports from the Paris meeting, which showed considerable interest by lenders in much of the development plan, are an indication of how radically the country's international economic picture has changed in the last three years. Foreign reserves and export earnings have soared, and the country has maintained an enormously improved credit rating since it prepaid so much of its international debt.

What happened, economic observers believe, was a combination of IMF-imposed austerity, sudden large increases in the world price of Peru's export crops and minerals and a surge in Peru's oil production just as the price of oil was shooting up. "To what extent their big success was due to the IMF stabilization program, or, on the other hand, to this fortuitous increase in mineral and export prices, I don't know," one foreign economist said. "They had a right to be proud of it, but they tned to emphasize more their astute fiscal and financial wizardry, and downplay the fortuitous minerals and petroleum picture."

Inside Peru, however, the economic situation is considerably less bright. Unemployment and underemployment are generally estimated, as they have been for the last few years, at more than 50 percent. The combination of late-1970s government policy and the IMF austerity program made life desperately hard for many of the nation's poor and working people, and the last two years' increases in purchasing power have not come close to making up for losses suffered in the last decade.

Although the government was projecting an overall growth rate of 65 percent for the first quarter of the year, malnutrition, infant death and illiteracy are still substantial problems in Peru.

Before Belaunde stepped into office last July, taking back the presidency after the military ousted him 12 years earlier, he said he wanted to attack some of those problems by creating a million new jobs in two years. To do that that, he needs the capital of international public and private lending agencies -- which will saddle Peru, even at low, "soft loan" interest rates, with another enormous debt.

"Technically, it's right, if only they would stick to this," one economist said, holding a copy of the thick volume in which Peru presented its public works proposals to the consultative group in Paris. "Maybe there's a little bit of politics in here, but not much."

He said there was real concern among the international lending community that Peru might press for even more development, extending itself beyond its ability to repay the loans.

The public works proposal comes at a delicate time for Peru's economy. After the 12-year military regime -- which began as a nationalistic experiment in state expansion and land redistribution, and ended with military leaders beginning to pull back and denationalize the economy again -- Peruvian officials are trying to encourage private investment and apply such free-market principles as lowered tariffs and reduced subsidies for exporters.

This is political dynamite in Latin American countries whose industries have grown up protected from outside competition. Prime Minister Manuel Ulloa, who is also minister of finance and of the economy, has been the subject of intense criticism from angry industrialists and businessmen -- a situation much like the recent conflict in Argentina, where former economy minister Jose Alfredo Martinez de Hoz was blamed for crippling the nation's industry with his policy of free-market international competition.

Even the Peruvian military has gotten into the fray. Last March, the national oil company Petroperu signed a 30-year contract with Superior Oil Co. of Houston, the first international contract to be signed under new regulations allowing tax credits for reinvestment by foreign countries.

Some nationalists and politicans within the Peruvian left have attacked the new law as being overly generous to foreign companies -- the same criticism that was made of Belaunde's oil policies when the military took over in 1968. When the Superior deal was signed last March, a high Peruvian armed forces official publicly expressed concern about it, leading to a nervous round of coup rumors.

"Really, it was not a problem," said Belaunde, who is believed to have privately worked out the compromise satisfying some of the armed forcesh concerns about excessive concessions to the American company. "They had certain points of view that were justified, others that weren't. . . . Whenever an objection was made, we tried to find an answer."