A Panorama programme examining the methods of the undercover investigative journalist is due to be shown on BBC One on Monday November 10.
Refusing the injunction, which would have covered any images taken since April 5, 2006 not already in the public domain, the judge, Sir David Eady, said the court had “no reason to restrict the corporation’s freedom of speech or editorial discretion”.
Mr Mahmood was refused permission to appeal but can still apply to the Court of Appeal direct.
After the ruling, the BBC said it would not broadcast any images of Mr Mahmood in trailers for the programme, which had been taken after April 2006 except for those already in the public domain, between now and 6pm on November 10.
Mr Mahmood exposed various personalities while working at the now defunct News of the World, using his disguise as a sheikh.
But, after the collapse of the drugs trial of pop star Tulisa Contostavlos in July, a judge said there were grounds to believe he had lied.
Mr Mahmood, who denies any wrongdoing and has not been charged, is currently suspended by The Sun and a number of cases in which he was set to be a witness have been dropped by the Crown Prosecution Service while investigations continue
His counsel, Adam Speker, told the judge in London that showing his current appearance in a broadcast which was likely to be watched by millions was intrusive and not in the public interest.
Because of his work, threats had been made to Mr Mahmood, who lived a reclusive life in secure accommodation with 24-hour surveillance and where his neighbours did not know his real identity, said counsel.
Mr Mahmood had been filmed in shadow during an appearance on the Andrew Marr show in 2008, photos in a memoir he had written were not sufficient to identify him and various courts, including the Leveson inquiry, had taken steps to conceal his physical identity.
Manuel Barca QC, for the BBC, said that Mr Mahmood’s identity was no secret and that the case was not about any fears for his safety but about protecting his livelihood and the shelf life of his professional stock-in-trade.
He said the public interest was self-evident, not least in the context of the Contostavlos trial.
The judge said it was an unusual “if not unique” application.
He ruled that Mr Mahmood had not discharged the heavy burden of proof under the Articles of the Human Rights Act upon which he relied.