The United States hopes to pay $188 million of its debt to the United Nations before the year is out to help prevent the world body from running out of money when it may need to mount a peacekeeping operation in the Persian Gulf, U.N. Ambassador Vernon Walters said Friday.

Walters told reporters he is "guardedly optimistic" that a cease-fire will be arranged to halt the Iran-Iraq war, and estimated initial costs of a U.N. peacekeeping force at $15 million to $20 million.Walters, testifying before the Senate Foreign Relations Committee, said that if progress is reached at resolving other world problems - including the Soviet occupation of Afghanistan, the Cuban presence in Angola, a transition to independence for Namibia, and the Vietnamese occupation of Cambodia - the U.N. could face an annual peacekeeping bill of more than $1.5 billion.

"All of these are important to the interests of the United States, and all are likely to involve the United Nations significantly," Walters said. "This increase in activity takes place at a time when the U.N. is facing a very tight cash situation."

The U.N.'s financial plight is due in part to the fact that the United States, partly for policy reasons and partly because of budget constraints, has withheld or been unable to pay its full U.N. assessments.

"At present we owe the U.N. in excess of half a billion dollars - $467 million for the regular budget and $70 million for peacekeeping," Walters noted.

The United States has not paid its full assessment for three years.

The initial withholdings were intended to spur the U.N. into making management and financial reforms.

Walters said these changes were made in 1986.

But in the congressional appropriations process over the past two years, other large cuts were imposed with the United States paying only $144 million of its $212 million assessment in 1987.

Walters said it is too early to tell if the withholding of much of the U.S. assessment has had a negative impact on the U.N. peacekeeping efforts.

He noted that U.N. Secretary General Javier Perez de Cuellar has said that without a large U.S. payment the organization would run out of funds by November.

If the U.N. is required to mount a peacekeeping operation in the Persian Gulf, it could run out of money in October, Walters said.

But he said that the Reagan administration hopes "to release $188 million in regular payments to the United Nations between now and the end of the calendar year."

Sen. Nancy Kassebaum, R-Kan., who sponsored the Senate amendment to withhold payments to the U.N., suggested the debt be paid over a period of years and Walters said that might be done.