The union said that 88 per cent of London’s traditional black cab drivers were white and remained exempt from the charge.
It also pointed out that women, who are more likely to work part-time, were disproportionately affected, and disabled passengers would be adversely affected by a reduction in the number of available minicabs.
Giving a judgment in London, Justice Lewis said Khan was pursuing a legitimate way to reduce traffic and air pollution.
The judge said the decision was “a proportionate means of achieving a legitimate aim, namely the reduction of traffic and congestion within the congestion charge zone without reducing the number of designated wheelchair-accessible vehicles.”
In a statement after the ruling, a Mayor of London spokesman said: “We are pleased with the judge’s decision.
“Removing the congestion charge exemption for private hire vehicles, apart from those that are wheelchair-accessible, is an important part of our plans both to reduce traffic volumes and congestion in London, with the additional benefits of reduced air pollution.’
In a statement, IWGB general secretary Jason Moyer-Lee said the union would appeal the ruling, saying: “The IWGB is not about to give up at the first set-back.”
He added: “The judge, defendant Sadiq Khan, and we all agreed that this charge is bad for ethnic minority and female drivers.
“The question is whether or not the mayor can legally justify it by showing it’s reasonable and there were no better alternative measures to reduce congestion.
“He hasn’t done this and the judge adopted the incorrect legal test when assessing the matter. So now we take the fight to the Court of Appeal.”