John Biggs said Lutfur Rahman, independent Mayor of Tower Hamlets in east London, and his supporters made "unfounded" allegations in opposition.
At the Election Court - part of the High Court - four voters allege that Mr Rahman committed electoral fraud.
Mr Rahman's lawyer has called the allegation "unfounded and false".
Labour London Assembly member and former Tower Hamlets leader Mr Biggs stood as a candidate against Mr Rahman, the incumbent Tower Hamlets mayor in the May 2014 election.
He came second to Mr Rahman, receiving 32.82% of first preference votes.
Giving evidence on the second day of the special hearing, he said he had been referred to as "John Bigot" by Mr Rahman's election agent and mentioned in the same breath as Oswald Mosley, the founder of the British Union of Fascists,
But he said he had always campaigned against racism and would "defy anybody" to argue that he had not.
He said the Tower Hamlets election campaign had been "far and away" the "most unpleasant, personally abusive and vicious" he had been involved in.
Speaking about Mr Rahman, he said: "On the face of it he is a personable and courteous, if inscrutable fellow.
"I have learnt that behind the exterior is a quite ruthless and determined organiser."
Four petitioners - headed by Andy Erlam, who stood as a Tower Hamlets councillor on an anti-corruption ticket - have mounted a challenge to Mr Rahman's re-election under the provisions of the 1983 Representation Of The People Act.
Election Commissioner Richard Mawrey - a senior lawyer sitting as a judge - has been asked to declare the result of the May 2014 mayoral election void and order a re-run.
Mr Rahman, who was in court to watch Mr Biggs give evidence, says there is "little if any" evidence of wrong-doing against him.
His lawyers have described the group of four's claims as "invention", "exaggeration" and "in some cases, downright deliberately false allegations".
The hearing continues.
A senior London Labour politician has told a judge he was falsely presented as a "racist" in an attempt to influence an election result.