The Senate approved yesterday a $4 billion bailout of the battered Farm Credit System, the nation's largest farm lender, and sent the legislation to President Reagan for his signature.

The Senate passed the bill assisting the farmer-owned lender on an 85-to-2 vote. The House had passed it, 365 to 18, on Friday.

"Without credit, rural America will collapse," Senate Agriculture Chairman Patrick J. Leahy (D-Vt.) said during an unusual Saturday session made necessary by continuing disagreement between Congress and Reagan on budget and deficit-reduction legislation.

Leahy predicted that Reagan, who earlier threatened a possible veto, will sign the bill because a veto would "trigger bankruptcies that are totally avoidable and would end up costing the taxpayers a great deal of money."

Sen. David L. Boren (D-Okla.), after talking to administration officials, said, "It is very likely the president will approve this legislation and sign it into law."

The new Farm Credit System bailout is the third in three years, but lawmakers think this one may succeed where earlier rescue attempts failed.

The first federal rescue in 1985 required stronger members of the 37-bank system to share funds with weaker ones before federal aid was triggered. The strong banks challenged the measure in court and thwarted its effectiveness.

Last year, Congress gave the system's banks authority to lengthen the period for writing off losses. But by early 1987, leaders of the federally chartered system told Congress the two previous laws were insufficient and asked for a $6 billion federal bailout.

In the interim, the agricultural economy began to rebound as farm income set a record, farm exports rose for the first time since 1981 and land values began rising slightly.

But the Farm Credit System remained a victim of previous years of plummeting land values and high interest rates. Although it finally showed a $4 million profit in the third quarter of 1987, some of its banks have nearly failed.

The bill would authorize a private entity to issue up to $4 billion in bonds, backed by a partial government guarantee, with funds distributed to banks by a newly created assistance board.

Under the bailout, the Treasury would pay interest for the first five years and would share interest payments with a reorganized system in a second five-year period. The system itself would pay interest in the last five years.

To offer another source of credit to rural America, the bill phases in a secondary market for farm mortgages and rural housing modeled after entities that funnel investment money to home mortgages.