The Senate voted yesterday to cut more than $500 million out of the $5 billion federal child nutrition program -- but only after tacking on a provision aimed at ridding farmers of their grain-embargo and market-glut blues.

The rider, proposed by Sen. Bob Dole (R-Kan.) and approved by voice vote, would raise loan rates that farmers get for wheat, corn and soybeans and set up a special reserve to keep embargoed grain off the domestic market.

Faced with farmers' complaints that grain prices have suffered a double-barreled blow from the partial embargo on grain sales to the Soviet Union and from bumper grain crop yields, the White House has been considering moves to increase price support levels. Dole, in effect, beat the administration to the punch.

His rider would raise regular per-bushel loan rates from $2.50 to $3 for wheat, from $2.10 to $2.25 for corn and from $4.50 to $5.02 for soybeans. It would also set up a special new, and higher, loan rate on grain going into farmer-held reserves. A new "humanitarian food reserve" of 4 million metric tons of wheat would be set aside for international relief purposes, thereby locking embargoed grain out of the domestic market and keeping it from further depressing domestic prices.

The legislation to which Dole's rider was attached authorizes continuation through 1984 of child nutrition programs, including the politically popular school lunch program for 27 million children. But the programs would continue at a reduced level because of the over-all congressional budget-cutting drive.

The bill reduces federal assistance in both cash and commodities and tightens eligibility requirements for some programs, including school lunches. A floor amendment was approved that woud, in effect, allow states to drop the controversial summer food service program.