The Senate yesterday hastily passed a multibillion-dollar election-year farm bill that one supporter said would never become law and opponents said could raise food prices $4 a week for a family of four.

The bill started out as an attempt by Sen. Herman E. Talmadge (D-Ga.) to put cash quickly in the hands of hard-hit farmers with a land diversion bill that would pay them an average of $75 an acre to take out of production this year at least 31 million acres of wheat, feedgrains, cotton and soybeans. Talmadge last week urged members of his Agriculture Committee not to add controversial amendments so the legislation could be enacted before spring planting.

But yesterday, with Talmadge's support, the Senate voted 53 to 35 to add to his bill an amendment by Sen. George McGovern (D-S.D.) that would go in the opposite direction, encouraging more production by raising price support levels by about 20 percent.

Then the Senate approved, 53 to 39, an idea from Sen. Bob Dole (R-Kan.) called flexible parity that would let a wheat, feedgrain or cotton farmer set his own price support levels by a formula that would raise price supports in proportion to the amount of land taken out of production. It would raise both the target prices that the government agrees to give farmers directly and the loan prices that the farmer can borrow by "loaning" his crop to the government.

The Senate then passed the bill, 67 to 26, but it seemed unlikely that it could work out some consensus with the House on a bill before the Easter recess. When congress returns, many southern farmers will have planted their crops and could take part in a land diversion program only by plowing them under.

Talmadge predicted during yesterday's debate that the Dole proposal would never become law because it would either be blocked by the House or vetoed by President Carter. But he agreed to take it on conference with the House.

This probably would slow down action on the bill even more, though Talmadge kept saying that "time is of the essence" in passing a bill before spring planting.

Agriculture Secretary bob Bergland told reporters after a meeting with Carter there is "little or no" backing in the administration for the Senate package.

Bergland said Carter made no direct veto threat "but it was clear there is little or no sentiment for the combination" of measures in the Senate bill.

Bergland added there is a 50-50 chance the administration will use existing legal authority to activate a scaled-down version of the Talmadge plan.

Whatever else it accomplished, the senators' action may have gotten off their backs hundreds of glum, visorcapped farmers who have filled Talmadge's committee room and, yesterday, the Senate's visitors galleries waiting for Congress to help them out of their cost-price squeeze. Farm income has dropped from $33 billion to $20 billion in six years because of surpluses and rising costs.

Sen. Edmund S. Muskie (D-Maine) tried in vain to defeat the McGovern and Dole amendments as inflationary. He also complained that the bill had moved so quickly that the Congressional Budget Office had not had time to analyze fully its impact on the budget or inflation.

Muskie said the CBO estimated that what he called the "three-headed monster" of McGovern-Dole-Talmadge could add one percentage point to the rate of inflation, running at about 7 percent annually. The budget office also told him that the bill could raise food costs for a family of four by $130 to $220 a year.

Cost figures for the three-part bill were not available. Each of the parts would cost $2 billion or more a year standing alone. But Muskie said there was no way now to determine the cost when all are put together. Talmadge's plan was expected to result in eventual savings by reducing government price support payments.

Sen. Dick Clark (D-Iowa), the only Agriculture Committee member to oppose the Dole plan, called it a "cruel hoax" because it held out hope to farmers in his opinion, could not become law. He said the Talmadge plan would be of some help.

On effect of the farm debate was to delay until this afternoon the first formal meeting in three months of the House-Senate energy conferees, who have scheduled a 2 p.m. meetings to discuss possible compromise on the long-deadlocked natural gas pricing issue.

On final passage of the farm bill, Maryland Sen. Paul S. Sarbanes (D) voted in favor, while Sen. Charles McC Mathias Jr. (R) voted against. Both Virginia senators voted against.