The White House and congressional supporters of foreign aid won an unexpected victory yesterday when the House narrowly defeated attempts to prohibit international banks from using U.S. contributions to assist such countries as Uganda, Cambodia, Laos and Vietnam.

President Carter had complained that such restrictions tied his hands in setting foreign policy and that the banks are not allowed to accept money from member nations with strings attached.

Last year such amendments passed the House by better than 2-to-1 majorities and tied up the foreign aid appropriations bill in House-Senate conference until Carter agreed to instruct U.S. representatives on the banks to vote against loans to such countries.

This year the situation was expected to be worse because it is election year and because Proposition 13 backlash has made the always unpopular foreign aid bill even more disliked.

But on a 203-to-198 vote, the House defeated an amendment by Rep. C.W. (Bill) Young (R-Fla.) prohibiting indirect aid to Laos, Cambodia, Uganda and Vietnam. It also defeated 360 to 41 an amendment by Rep. Tom Harkin (D-Iowa) to prohibit indirect aid to Nicaragua, the Philippines, Indonesia, Korea, Uruguay, Chile and Argentina, countries where Harkin said right-wing dictators had violated human rights. By voice vote the House defeated attempts to prohibit indirect aid to Mozambique and Angola.

A heavy lobbying effort by the White House, State Department, church orgainzations League of Women Voters and Chamber of COmmerce was credited with the turnaround.

Young argued that in a year when other appropriations bills were being cut. American taxpayers would not want their money to go, even indirectly, to such countries.

But foreign operations appropriations subcommittee member Rep. David Obey (D-Wis.) said the amendments would destroy the structure of the banks, such as the World Bank, which the United States helped to set up to "enable us to spread the burden of foreign aid around." He said U.S. contributions to the World Bank have declined from 50 percent of total contributions to 18 percent in recent years.

Obey read a letter from eight former secretaries of the treasury who said tying strings to tU.S. contributions would end participation in the banks, since the banks' charters prohibit them from accepting money with strings attached in order to keep the banks out of politics.

Still to be decided are attempts to cut the level of the $7.3 billion appropriations bill which is $1.1 billion below the administration request because of Appropriations Committee actions.

An amendment by Harkin to cut by 2 percent, or $45 million, nonmilitary aid for countries with the exception of Syria, Jordan, Egypt and Israel was adopted 293 to 52, but an amendment by Rep. Clarence Miller (R-Ohio) to cut 8 percent of the nonmilitary aid - about $63 million - was rejected by voice vote.

Still to come when the House resumes work on the bill will be attempts to cut the entire aid package by 8 percent across the board - about $500 million - and an attempt to reduce by $584 million the U.S. contribution to two international development banks.

After yesterday's action the foreign aid bill is in better shape than anyone would have predicted a week ago but if the deeper cuts are approved the bill could be in some difficulty because foreign aid proponents might then consider it inadequate.