The Senate voted yesterday to ensure that revenue surpluses generated by its tax-overhaul legislation will not be used to reduce the deficit.

The vote was aimed at pressuring Congress to deal with the 1987-88 deficits by separately raising taxes this year rather than by applying the roughly $30 billion in excess revenue the bill would bring in by 1988.

The legislation would raise dramatically different amounts of money from year to year, creating surpluses through 1988, but generating the same amount of money as the current system over a five-year period.

The bill is expected to be approved overwhelmingly today, although not unanimously, as originally predicted by some Senate leaders. Sen. Carl Levin (D-Mich.) announced yesterday that he would vote against the package because it "takes unacceptably high casualties in its attempt to win the battle of tax reform."

Levin said the bill, which would curtail numerous tax benefits while reducing the number of tax brackets and cutting the top tax rate for individuals, increases taxes on too many middle-income Americans and does not deal with the need to reduce the federal deficit.

Sen. John Melcher (D-Mont.) also said yesterday that he would vote "no," based on treatment of the middle-income issue and of his state's primary industries.

"This is a phenomenon I haven't seen in my 17 years in the Senate, this euphoria over a bill," Melcher said. "We haven't handled trade, we haven't handled the deficit. But now everyone can say, 'By God, we wiped out some loopholes that taxpayers find incompatible with equity.' This ain't much, but it's better than admitting we haven't done anything else."

Senators reported by their staffs to be undecided included Sen. Sam Nunn (D-Ga.), Sen. Daniel K. Inouye (D-Hawaii) and Sen. Dale Bumpers (D-Ark.). In the Washington area, Sens. Paul S. Trible (R-Va.) and John W. Warner (R-Va.) both planned to vote for the measure. Sen. Paul S. Sarbanes (D-Md.) was leaning toward a "yes" vote, and Sen. Charles McC. Mathias Jr. (R-Md.) would not disclose his plans.

Senate Finance Committee Chairman Bob Packwood (R-Ore.) and other proponents of tax revision said they believe an overwhelming vote for the legislation will give Senate negotiators more bargaining power in the conference committee that will attempt to reconcile the Senate bill with its House counterpart.

Also yesterday, the Senate agreed to a compromise amendment sponsored by Sen. George J. Mitchell (D-Maine) that broadens a tax credit for low-income housing. The expanded credit could be used to help finance housing projects that receive federal funding, as well as for private housing. The $1.5 billion the amendment would cost was replaced by limiting the phase-in of the bill's crackdown on tax shelters to existing shelters and by tightening accounting rules for certain limited partnerships.

Under the surplus-revenue amendment, sponsored by Sens. Pete V. Domenici (R-N.M.), Phil Gramm (R-Tex.) and Warren B. Rudman (R-N.H.), Congress simply would not count the surpluses and shortfalls generated by the tax-overhaul bill in its calculations of tax revenues and deficits. The bill would raise revenues by $7.4 billion in fiscal 1986 and $22.8 billion in 1987, would lose $20.7 billion in 1988, $21 billion in 1989 and $400 million in 1990, and gain $11 billion in 1991.

Senate Majority Leader Robert J. Dole (R-Kan.) had favored using the excess revenue in the early years to help meet revenue-increase targets in the 1987 budget resolution being negotiated by a House-Senate conference committee.

He did not appear to be present on the Senate floor during the debate and voice vote on the Domenici amendment.