The Senate -- reversing itself on an immigration amendment -- approved a controversial plan yesterday to allow 350,000 additional foreigners into the country for part-time agricultural work.

The amendment by Sen. Pete Wilson (R-Calif.) had been heavily pushed by lobbyists for a variety of agricultural concerns. It passed on a voice vote following a 51-to-44 procedural vote in its favor.

Sen. Alan K. Simpson (R-Wyo.), chief sponsor of the immigration-revision bill, opposed the amendment, saying that it would "repeat the most serious errors we have ever made in our immigration policy."

Using the word "greed" to describe crop and fruit growers, Simpson said, "I never could satisfy the perishable-fruit growers. Anything I could propose, they would reject."

The Senate is expected to take a final vote on the immigration legislation this morning after it deals with an amendment from Sen. John Heinz (R-Pa.) proposing that the Social Security system not be included in the unified federal budget.

Heinz's amendment is a nonbinding sense-of-the-Senate resolution. Senate Majority Leader Robert J. Dole (R-Kan.) has asked that Heinz attach it to a more relevant bill.

The immigration bill, which has been debated for five days on the Senate floor, contains three major provisions:

*Illegal aliens who have resided in the United States since Jan. 1, 1980 would be eligible to apply for legalization of their status.

*Employers who knowingly hire illegal aliens would face civil fines, with repeat violators subject to criminal penalties.

*Enforcement of immigration laws would be strengthened by giving additional resources to the Border Patrol and the Immigration and Naturalization Service.

The bill contains a provision that would streamline and expand an existing program, known as "H-2," that allows workers into the country temporarily for field labor.

The Wilson amendment, a revision of an earlier effort that failed last week on a 50-to-48 vote, puts into place an additional method that would allow even more foreign workers into the country.

Wilson's plan would allow the workers to come for up to nine months to harvest perishable crops.

As an incentive for the workers to return home, 20 percent of their pay would be withheld and returned to them in their home countries.

Under the amendment, the procedure would be reviewed at the end of three years by the attorney general, who could adjust the 350,000 figure up or down.

"The amendment is a very large guest-worker program," Simpson charged. "The number of actual admissions in any one year could be much higher."

In an uncontested amendment offered by Wilson, the Senate decided to provide the states with funding for social services needed by newly legal aliens. The amounts approved were $300 million in each of the next two years and $600 million in each of the following four years.

The Congressional Budget Office projected last week that about 1.4 million of the estimated 5.6 million illegal aliens in the country would seek amnesty under the Senate bill, costing about $1.8 billion in social services over the next four years. Several states, including Florida, Texas and California, are expected to be hard hit by such costs.

Several amendments were defeated.

One by Sen. Paul Simon (D-Ill.) would have forced the INS to end the practice of refusing nonimmigrant visas to persons on the basis of their political beliefs, provided they are not terrorists or felons.

Simon, pointing out that such visas have been denied in the past to former Canadian prime minister Pierre Elliott Trudeau and English novelist Graham Greene, called the current system "a needless restriction of freedom of speech." His amendment was tabled, 66 to 30.

The Senate also defeated on a 66-to-30 tabling motion an amendment by Sen. Steve Symms (R-Idaho) to forbid federal loans to Mexico or any other country in North America that allows into its ports any Soviet ship capable of carrying nuclear weapons.