Attorneys for Beckham filed the $25 million libel lawsuit against In Touch Weekly and the woman, Irma Nici, in Los Angeles federal court last December.
U.S. District Judge Manuel Real said Beckham is a public figure and there was no evidence that the magazine published the story with malice. He also said claims of adultery by Beckham would be of interest to the public.
Beckham claimed he never met Nici and was in London at the hospital bedside of his father Ted, who was recovering from a heart attack, on the night in question.
The libel lawsuit was initially filed in Los Angeles Superior Court last September against Bauer Publishing Co., alleging In Touch published false information and had quoted a woman who claimed Beckham paid for her services five times and also patronized another prostitute. The lawsuit was then transferred to federal court.
Beckham, 35, and his wife Victoria -- Posh of the Spice Girls -- have been married for 11 years. They have three children and are awaiting the birth of their fourth child in July.