The Senate Governmental Affairs Committee, nearing final approval of legislation to create a new Department of Education, voted 8 to 7 yesterday to shift various child nutrition programs, including school lunches and breakfasts, from the Agriculture Department to the new department.

The action, which President Carter had recommended in his proposal for an education department, appeared certain to touch off a floor fight when the full Senate considers the bill later.

Senators from agricultural states are expected to offer amendments to keep the $3 billion nutrition programs in the Agriculture Department.

Sen. George McGovern (D-S.D.), a leader of the Senate Agriculture Committee, which opposes the shift of child nutrition to the proposed Education Department, said after yesterday's vote, "Transferring child nutrition to the Department of Education is asking us to buy a pig in a poke" on programs that feed 25 million children. He said Carter's decision to include the feeding programs in the new department was an attempt to gather political support for the department.

In another action yesterday, the committee confirmed a tentative earlier decision to exclude the $680 million Head Start-Follow Through programs from the new department and leave them in the current Department of Health, Education and Welfare.

Carter had proposed shifting Head Start, but groups representing blacks, poor families, and children said Head Start provided a battery of welfare, health and other services best coordinated through HEW and should stay there.

Earlier this week, the committee approved an amendment by Sen. Muriel Humphrey (D-Minn.) shifting $912 million in vocational rehabilitation programs from HEW to the new department, despite opposition from Carter.

As the bill is shaping up, the new department will have a budget of nearly $18 billion a year and nearly 24,000 employes. It will include all the major education programs currently in the Department of Health, Education and Welfare, such as elementary and secondary education aid, and a variety of higher education programs (total funding about $12 billion to $13 billion a year); child nutrition from Agriculture (about $3 billion); vocational rehabilitation; the educational functions of HEW's Office of Civil Rights (1.200 employes); the Defense Department's overseas schools (10,000 employes); the Bureau of Indian Affairs schools (6,550 employes) and various other programs.

Next week the committee will vote on a controversial amendment proposed by Sen. William V. Roth (R-Del.) barring the new department from requiring the busing of students for racial purposes. The proposal is similar to restrictions on busing carried on appropriations bills in the past two years, but would lock the provision permanently into the charter of the new department. It does not affect court-ordered busing.

Sen. Charles H. Percy (R-Ill.) led the fight yesterday to keep child-feeding programs in the Agriculture Department, saying "educators . . . have a history of not particularly welcoming" these programs. However, chairman Abraham A. Ribicoff (D-Conn.), opposed him. Saying that while the Agriculture Department and "agricultural interests" now were attempting to hold on to the child-feeding functions in the past they had often failed to seek adequate funding and had subordinated itto farm producer interests.

As a compromise, however, Ribicoff inserted an amendment specifying that about $560 million a year used by Agriculture to purchase commodities for donation to the school-lunch and breakfast programs remain under control of the Agriculture Department and be included in the Agriculture Department budget. The remaining $2.5 billion used for administrative costs of the program, preparation of meals in schools and local purchases by schools, would be in the Education Department.

The House Government Operations Committee is scheduled to begin hearings on similar legislation on July 17.