The prime minister is alleged to have placed “a private part of his anatomy into a dead pig's mouth” as part of an initiation ceremony, according to a book published by former Conservative party treasurer Lord Ashcroft.
The Ukip leader made the joke during his keynote speech at the Ukip party conference in Doncaster.
Explaining how he saw the current state of play in the EU referendum campaign, Mr Farage said there were three sides.
He said there was the In campaign and the Out camp, before adding: "And then we've got the Prime Minister. Or should I call him, in this context, piggy in the middle," he joked, drawing huge applause and laughter from the audience.
David Cameron's biggest controversies
Show all 8
The Call Me Dave biography, written by former deputy Conservative party chairman Lord Ashcroft and journalist Isabel Oakeshott, claims that Mr Cameron was a member of the exclusive Piers Gaveston Society while studying at Oxford University, which is said to have involved “bizarre rituals and sexual excess”.
The book quotes a “distinguished Oxford contemporary”, who is now an MP, recalled how Mr Cameron took part in an “outrageous” initiation.
“His extraordinary suggestion is that the future PM inserted a private part of his anatomy into the animal’s mouth,” an excerpt published by the Daily Mail reported. However, the MP reportedly states that he had not seen any evidence himself and that it could be a case of mistaken identity.
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies