A long day of legislative politics ended here tonight with a proposed increase in truck taxes temporarily defeated, a $12 million horse-racing reorganization bill strapped with amendments, and the fates of a number of major and minor bills suddenly linked by unabashed dealing.

With the legislature due to adjourn at midnight Monday, almost all major bills still alive here -- and several that technically are dead -- have become the stuff of intense backroom batering as the session turns into a race against the clock.

Somewhere beneath the Byzantine maneuvers lies the remains of Gov. Harry Hughes' tax and spending package, which seemed in danger today of being crushed by rivalries between House and Senate leaders.

In the Senate, budget committee members who favor the proposed cent-a-gallon gasoline tax increase, which Hughes supports, voted down the Hughes-endorsed truck tax, knowing full well that it was the prized project of the House committee now considering the gas tax.

Meanwhile the members of the House Ways and Means Committee and Speaker Benjamin L. Cardin, who have doggedly opposed gasoline tax proposals since last fall, were laying plans to add a host of amendments to the Senate's gas levy tomorrow morning despite warnings from Hughes and Senate leaders that their tampering probably would doom the bill.

Legislative leaders held out the possibility that they could strike a compromise that could save at least the gas tax.

"It will be very tricky, but it could happen," said Senate Budget and Taxation Committee Chairman Laurence Levitan (D-Montgomery). But any such deal, legislative leaders noted, would have to force powerful politicians here to back down from public positions -- admittedly an unlikely development in the closing hours of a chaotic and acrimonious session.

On the Senate floor, meanwhile, the embattled racing bill suddenly became the vehicle for a bevy of legislative schemes, most aimed at stalling for time on other bills still to be considered.

"There are about 15 games being played with this bill, and none of them have anything to do with racing," remarked Sen. Victor Crawford (D-Montgomery) -- who himself offered 15 amendments to the measure, already hobbled by several dozen other amendments.

Senators who never had expressed concern over the $12 million proposal that the state buy and operate the Bowie thoroughbred racetrack suddenly rose to engage in lengthy debate about some of the bill's more arcane features. Among the debaters were staunch opponents of a labor-backed bill to raise the wages of construction workers employed under state contracts, and another measure that would give optometrists greater freedom to compete with ophthalmologists.

Those two measures were scheduled to come up later, but Senate opponents were hoping to delay action long enough to filibuster them to death in the last hours of the session.

The horse-trading atmosphere became so pervasive that a proponent of the racing bill attempted to make a trade with an opponent who needed votes for a bill to increase welfare benefits. Sen. John Cade (R-Anne Arundel), sponsor of the welfare bill, was vigorously protesting the racing bill when Del. Paul Weisengoff, the legislature's chief racing strategist, came to the floor of the Senate.

Weisengoff, disturbed over the challenges to the racing bill, mentioned to bystanders that his House committee, where he wields considerable influence, today passed Cade's welfare bill in a weakened form but still could decide to kill it in a special session on Saturday morning. Asked if he planned to cut a deal with the Anne Arundel Republican -- race tracks for welfare benefits -- Weisengoff smiled and said, "I'm just here to see what's going on."

Earlier, Weisengoff's committee had attempted to amend the welfare bill to make it contingent on Senate passage of the track tax. Noting that Cade and two other Senate cosponsors of the welfare increase had voted this morning to kill the truck tax, several members of the House committee asked, "Why should we do anything for these guys?"

The racing bill won a test vote on the Senate floor by 33 to 10 tonight, but still faced dozens of amendments.

While the racing debate dragged on in the Senate, a House committee chairman renewed one of the most intense special-interest debates of the session by attempting to weaken a bill that would ban an unusual shortcut procedure for raising rates that is favored by state utility companies.

The racing bill won a test vote on the Senate floor by 33 to 10 tonight, but still faced dozens of amendments.

Del. Torrey Brown persuaded his Environmental Matters Committee to approve an amendment that would allow the state's utility commissioners to decide whether utilities can use the controversial "make-whole" procedure in asking for gasoline and electric rate hikes.

A bill eliminating this procedure already has been approved twice by the House and was awaiting final passage in the Senate tonight. But Brown, an ally of utility lobbyists who have been working frantically to kill or weaken the measure, told the House committee that the measure in the Senate was stalled and that his alternative proposal was "more flexible." If approved by the House, Brown's amendment would send the issue to a conference committee on the session's final day for the second consecutive year.

In other action, the House passed a Senate bill today that would ban television and still cameras from court proceedings, ending an 18-month experiment begun in January by the state court system. A slightly less restrictive House bill is expected to be approved by the Senate, giving Gov. Hughes a choice of two bills to sign.

A measure providing limited protection to tenants of buildings being converted to condominiums also neared enactment when the House approved a compromise measure acceptable to industry and consumer groups. The bill, a major priority of Montgomery County Executive Charles Gilchrist, must return to the Senate because of amendments added by the House, but is expected to pass.