The Senate Agriculture Committee yesterday approved legislation that would give surplus federal food to the hungry, but left it up to the secretary of agriculture to determine when and how the program would work.

The measure was approved without a roll call after the committee, bowing to pressure by the Reagan administration, removed requirements for mandatory food distribution that Sen. Robert J. Dole (R-Kan.) had included in the original bill.

Agriculture Secretary John R. Block objected to the mandatory aspects of the Dole bill, which would have set up a permanent program to distribute $1 billion worth of federal food surpluses to charitable agencies feeding the poor and hungry.

The committee-approved bill also authorized up to $100 million annually for processing raw commodities into more easily used form, but it removed Dole language that would have provided about $52 million more to the states to distribute the final products to schools, soup kitchens, food banks and shelters.

The administration's objections to the Dole bill became known only minutes before the committee began deliberations on Wednesday. Deputy Agriculture Secretary Richard E. Lyng offered a set of handwritten amendments that he said represented the administration position.

Lyng and Block contended that the Dole legislation did not give the secretary enough leeway in determining exactly how the food donation program should be run. The version approved yesterday would allow the secretary to decide when commodities are in surplus and how much would be given away.

Dole said "strong mandatory language" was necessary to assure that the program works, and he indicated that he will attempt to amend the committee bill when it reaches the Senate floor. A version of the Dole bill is pending before the House Agriculture Committee.