Transport for London had refused to carry the ad on the grounds that it was "likely to cause widespread or serious offence to members of the public", and it contained "images or messages which relate to matters of public controversy and sensitivity".
Today the judge backed the TfL stance, despite her finding that there had been unfairness in its procedures.
The judge said TfL had applied its advertising policy "inconsistently and partially", but its refusal to display the gay ad was "justified and proportionate, in furtherance of the legitimate aim of protecting the rights of others".
More top news
Sunday will be dry with some long spells of sunshine across the region, but feeling colder in the easterly breeze.
Chelsea Football Club has "apologised profusely" to Gary Johnson who was sexually abused and "suffered unacceptably" as a youth team player.
A man has been jailed after his victim was found slumped in a car with stab wounds in east London.