The House Agriculture Committee voted yesterday to wipe out a $6.2 billion-a-year spending limit that would have forced the Federal Food Stamp program to shut down in June for lack of funds.

Instead, the committee agreed to allow $8.7 billion in fiscal 1980 and $9.7 billion in fiscal 1981, the amounts President Carter says are needed for full-year benefits to feed 20 million participants.

Committee Democrats also pushed through, by a 21-to-17 vote, an amendment by Rep. Dan Glickman (D-Kan.) allowing spending to exceed the new 1980 limit by 5 percent and the new 1981 limit by 10 percent if needed to meet demands caused by higher-than-expected inflation and unemployment.

Although the $6.2 billion ceiling was imposed only three years ago, rising unemployment, rising food costs and enrollment of more participants because of removal of the old "purchase requirement" have sharply boosted the program cost.

Carter asked congress to remove the existing $6.2 billion cap. The Senate has already voted to do so. However, House conservatives said that without some form of a cap, there would be no check on the program.

Chairman Thomas Foley (D-Wash.) said he wants to bring the stamps bill to the floor as soon as possible, so that the authorization, appropriation and budget resolution approval of the increases can be made final well before the "date sometime in June or July when the [Agriculture] secretary is going to have to tell the states . . . don't give anybody any more food stamps."

Under the food stamp program, which was started on a small scale under President Kennedy but which now has grown to one of the largest federal welfare programs, low-income people get federally financed food stamps which they can use like money to buy food at grocery stores.

A family of four without any other income gets $209 a month -- enough to buy the Agriculture Department's "thrifty" budget for such a family. The amount of stamps received is increased each six months for inflation. Families having some income get less than $209 worth of stamps.