The government of Argentina today signed agreements with its Western commercial bank lenders that allow it to borrow $4.2 billion to finance its needs through the end of this year.

The agreement was delayed five hours because of what Argentine government and American bank officials called technical problems. One difficulty was that changes in the agreement had to be cleared with commercial bank officials in Japan who, because of the time difference, were asleep, according to Argentina Economy Minister Juan V. Sourrouille.

Argentina had been unable to obtain funding from commercial banks and the International Monetary Fund since last February, after it failed to comply with the international lending agency's economic targets. In February, Argentina was scheduled to receive $243 million from the fund but did not because it was out of compliance with IMF targets last December.

The agreement with the banks comes at a time when some other Latin American countries have been flirting with the idea of setting their own terms for repaying foreign debt or outright refusing to repay. However, Argentina yesterday made clear that it wanted to follow IMF and commercial bank guidelines.

In a related development, Peruvian Prime Minister Luis Alva Castro said Peru will be able to pay only about $320 million on the $2.2 billion in interest and principal coming due in the next 12 months on its $14 billion of foreign debt.

United Press International reported that Alva Castro, who is also finance minister, reiterated pledges by new President Alan Garcia to limit Peru's debt payments to 10 percent of its export income and to negotiate the debt without the International Monetary Fund.

[In a four-hour, forty-minute speech Monday night before Congress, Alva Castro said he was not concerned Peru's debt rating could be downgraded when banking authorities meet. "We want to honor our obligations but not at the expense of the hunger and misery of our people," he said.]

"Today's signing demonstrated the confidence of the international banking community and the courageous program undertaken by President Alfonsin and his economicteam to tackle the economic problems that have plagued Argentina for years," said William R. Rhodes, chairman of the 11-member bank working committee for Argentina.

Rhodes also said thatThe resignation of Brazil's two top economic officials this week should have no effect on its debt situation.

The agreement with the banks is a medium-term loan of $3.7 billion and other funding of $500 million. The interest rate on the loan will be 1 1/4 percent over the U.S. prime lending rate. A fee of five-eighths percent will be added.

Today's agreement compared with the interest rate for Argentina's $1.5 billion loan two years ago of 2 1/8 percent over prime and a fee of 1 1/4 percent.

The new loan is for 10 years, compared with five years for the loan two years ago. Both have grace periods of three years. The other funding is for four years with an interest rate of 1 percent over the U.S. prime rate. A fee of one-half percent will be charged.

The first drawdown on the loans will be $2.2 billion in September.