WASHINGTON (AP) _ The Senate passed a massive $520 billion budget package today, the final legislative day of the 105th Congress, as lawmakers turned to the voters to assess a year marked by a breakthrough budget surplus and unrelenting partisan rancor.

The 65-29 vote for the bill that provides money for hundreds of federal agencies came amid resentment among many members about voting for a measure of such sheer immensity that few had had a chance to read.

``It is too big, and the process isn't the preferred way'' to construct such a bill, Senate Majority Leader Trent Lott, R-Miss., told a reporter just before the vote. ``But it is what is needed to keep important government programs working.''

Also on the congressional agenda for the final moments of the session were several nominations and noncontroversial bills.

Sen. Robert Byrd, D-W.Va., set the tone in the debate Tuesday when he called the 4,000-page bill a ``colossal monstrosity.'' After initially saying he would reluctantly vote for the bill, he ended up changing his vote to no.

Money to hire teachers, build a missile defense, find medical cures and put more cops on the streets was part of the giant measure that now goes to President Clinton for his signature. It ends a congressional session that celebrated the first budget surplus in 30 years and initiated for only the third time impeachment proceedings against a sitting president.

The House on Tuesday, in its last day of work, approved the bill by 333-95. It funds almost one-third of the federal budget and combines eight of the 13 spending bills Congress must pass each year.

The 40-pound bill covers health, education, foreign aid, justice and transportation programs. It meets a held-up administration request for $17.9 billion for the International Monetary Fund and adds $21 billion for emergencies ranging from natural disaster and farm relief to fixing the year 2000 computer problem.

Some Republican conservatives protested the spending levels, but House Speaker Newt Gingrich, R-Ga., in a closing speech aimed mostly at the ``perfectionist caucus'' in his own party, reminded them that ``if we don't work together (with Democrats) on big issues, nothing gets done.''

The catchall package was necessitated when Congress reached the beginning of the fiscal year on Oct. 1 with most of the spending bills unfinished. Republicans were hobbled by disunity in the ranks, Democrats delayed some bills in protest and Clinton threatened vetoes over others.

In the end, it took more than a week of closed-door negotiations between the White House and Republican leaders that gave Democrats some victories in education, the environment and heating aid for the poor and provided Republicans more money for defense and fighting drugs.

``We can take confidence in the fact that we have restored fiscal integrity to the United States treasury for the first time in a generation. I think that's no mean accomplishment,'' House Appropriations Committee Chairman Bob Livingston, R-La., said in asking House members to support the bill.

But many who voted yes did so reluctantly, either because of spending levels conservatives said were excessive or in protest of the way major decisions were left in the hands of just a few negotiators.

``Now we have this God-awful mess on the floor,'' said Rep. David Obey of Wisconsin, ranking Democrat on the Appropriations Committee. ``While it contains a number of needed victories'' for Democrats, he said, ``it still represents an incredibly outrageous way to do the country's business.''

Obey noted that some 70 legislative measures are included in the package, ranging from bills that dealt with Internet pornography to a change in the duck-hunting season for the state of Mississippi.

The spending package was laced with policy measures such as banning needle exchange programs in the District of Columbia, blocking a pay raise for members of Congress, prohibiting national educational testing and requiring health care plans for federal workers to cover prescription contraceptives.

House Democratic leader Dick Gephardt of Missouri took to the House floor with the 16-inch-high package tied in rope. ``This bill is a symbol of the wasted time and the misguided priorities of a Republican Congress whose leadership consumed our agenda with investigations instead of legislation,'' he said, urging voters to return Democrats to power.

``Send us more conservatives, send us more Republicans and next year we won't have to go through this process,'' countered Rep. David McIntosh, R-Ind.

In the Senate, Sen. Chuck Hagel, R-Neb., said he was voting against the bill because ``no one knows how many millions of dollars have been tucked away for special projects for individual members, behind a curtain.''

Republicans expressed begrudging admiration for the scandal-distracted president's ability to win major concessions on programs to hire 100,000 more teachers, create summer jobs and give emergency aid to farmers. ``The president and his supporters in Congress have proven extraordinarily resilient in treating every federal spending program as a sacred cow,'' said Rep. David Dreier, R-Calif.

``It is more of a Clinton budget than a Republican budget,'' said Republican presidential contender Steve Forbes. ``If the GOP had been more forceful on issues like tax cuts and the IMF, it would have had a wonderful platform'' to run on next month, he said.

But Republicans also took credit for a boost in anti-drug funding and more than $9 billion in emergency defense spending they said would reverse a 14-year decline in real defense spending, with money for military readiness and a national missile defense system.

``The funding is critical to protect the lives of our soldiers, sailors and airmen who serve our country overseas,'' said Rep. Gerald Solomon, R-N.Y.

__

The bill is H.R. 4328.