Ex-immigration minister Phil Woolas set out to "make the white folk angry" in his general election campaign, a specially convened court has heard.
His defeated Lib Dem rival, Elwyn Watkins, is challenging his re-election as Oldham East and Saddleworth MP - the first case of its kind for 99 years.
Mr Watkins claims the vote was swayed by Labour leaflets containing false claims.
Mr Woolas, who won with a majority of just 103 votes, denies the allegations.
He says he will "robustly defend" himself.
The court heard on Monday that diary entries kept by Labour MP Mr Woolas during the election campaign show he was "pretty convinced" he was going to lose.
Counsel for Mr Watkins Helen Mountfield QC said Mr Woolas was concerned about the effects of an anti-Labour swing nationally, the expenses scandal and decisions taken by him as immigration minister, adding: "Mr Woolas and his team were playing for high stakes and came up with a strategy to deal with the perceived Liberal Democrat threat which they themselves described as 'risky'."
"They set out to attack Mr Watkins personally and say whatever it took to turn the electorate against him."
The court was told that false statements were made in three publications on behalf of Mr Woolas in the run-up to the election.
She said: "Mr Woolas's team had made an overt and, some may say, shocking decision to set out to 'make the white folk angry' by depicting an alleged campaign by those who they described generically as Asians to 'take Phil out' and then present Mr Watkins as in league with them.
"This was intended to galvanise the white Sun vote against him," she said.
Miss Mountfield said Mr Woolas's team had said Mr Watkins had made statements to "woo" and "pander" to fanatics and militants and had refused "to condemn death threats which Mr Woolas claimed had been made against him because he was 'in the pay' of a rich Arab sheikh".
They also accused him of spending more than allowed on election leaflets, of illicitly channelling funds from a foreign donor, and of failing to move into the constituency as promised, the court heard.
Miss Mountfield said: "These statements were made in a desperate attempt to change the election result.
"Mr Woolas made these false statements as part of a series of reckless and irresponsible steps in this campaign - using doctored photographs, misrepresenting facts, stooping even to fomenting racial divisions and tensions. He did it because he feared that if he didn't he would lose.
"The petitioner fully supports the concept of robust political debate but that does not mean a free-for-all in which any candidate can say whatever they like."
The BBC's political editor for the North West Arif Ansari said Mr Woolas's team would argue that the statements they made were true. Mr Woolas is due to take the stand later in the week.
Two High Court judges will rule on whether there should be a re-run of the Oldham East election, in a case brought under the rarely-used section 106 of the Representation of the People Act (1983).
Under the act, anyone involved in an election who "makes or publishes any false statement of fact in relation to the candidate's personal character or conduct" is guilty of an illegal practice - unless they can show "reasonable grounds for believing, and did believe, that statement to be true".
Saddleworth Civic Hall, where Parish Council meetings are often held, is temporarily becoming an election court - in the first case of its kind in 99 years - for the hearing, which is scheduled to last five days.
Legally, the onus is on Mr Watkins to prove his case if he is to win.
If found guilty, Mr Woolas could be fined and barred from public office, with a fresh election triggered.