UBS AG's prospects hang in the balance this week as Swiss politicians vote on a tax deal that would draw a line under a legal dispute with the United States.

A risky game of brinkmanship by the country's two biggest parties could take the issue to the wire as the Social Democrats (SP) say they will only approve the deal if new taxes on bankers' bonuses are attached -- a condition the right-wing SVP staunchly opposes.

The U.S. government agreed last year to drop tax evasion charges against UBS after Switzerland promised it would transfer by this August details of clients the bank helped to dodge taxes, a move that would breach existing bank secrecy laws without parliamentary backing.

Switzerland's lower house rejected the treaty in a vote last week, starting a new parliamentary debate and delaying a final decision on whether to allow Swiss tax authorities to hand over 4,450 UBS client accounts to U.S. authorities by the deadline.

The SVP is also calling for a referendum on the issue, a measure which would prevent Berne delivering the data on time even if Swiss voters eventually give the deal their blessing.

The two houses have to agree a common text by the end of the week to save the deal or send the Swiss government scrabbling for a quick fix to prevent the United States restarting legal action against UBS, the world's second-largest wealth manager.

POTENTIALLY DISASTROUS

Analysts say if the deal falls through, it could be disastrous for UBS and potentially for other Swiss banks, rocking a financial sector that accounts for 12 percent of the Alpine nation's economy.

The lower house is due to vote again on Tuesday morning after the upper house again backed the treaty and rejected a referendum on the issue, leaving three possible outcomes.

If the lower house agrees or disagrees with the upper body on both counts, the deal stands or falls accordingly and the decision is final.

Should parliament's main body reject the treaty but recommend a referendum, as it did last week, the political game of ping-pong with the upper house continues and the lower house gets to take another, final vote on Thursday or Friday.

SVP leader Toni Brunner said his party, while prepared in principle to back the treaty, would take the issue right to the end of the week if necessary to prevent the SP getting its way on banker pay, while SP chief Christian Levrat remained adamant his party would only back the vote if its conditions were met.

But the leaders of center parties trying to push through the deal said parliament would back it in the end.

I am confident that there will be a majority in favor of the agreement, said Christophe Darbellay, leader of Switzerland's centrist Christian Democrats (CVP). Otherwise the SVP would definitively abandon its role as a party of businesses.

(Editing by David Holmes)