The minister tried to obtain an interim interdict against Penguin Books, claiming that an allegation about his involvement in an Orange Order "kick the pope" band was false and defamatory.
However, a judge at the Court of Session ruled that Penguin had an argument that adjectives applied by Mr Galloway to the band, such as "anti-Catholic" and "protestant-supremacist", were fair comment.
Mr Ingram is currently in Afghanistan, visiting troops. His lawyers accepted in court that for a year as a teenager in the early 1960s, he had been a member of the junior Orange Lodge in Barlanark, Glasgow, and had attended three parades.
But they maintained that Mr Galloway’s claim in his book I’m Not The Only One was made in bad faith. It was highly damaging to Mr Ingram’s reputation, they added, and he feared it could be used by political opponents and damage his chances of re-selection when changes are made to his East Kilbride constituency.
Lord Kingarth was asked by Graeme Henderson, the counsel for Mr Ingram, for an interim interdict to stop Penguin publishing the book, due out this week, or distributing any other document containing allegations that the minister "played the flute in a sectarian, anti-Catholic, protestant-supremacist Orange Order band".
The court was told that Mr Ingram, 57, was first elected as an MP in 1987, and became a minister in the Northern Ireland office in 1997. He took up his current post in 2001.
It was said that he had made no secret of his membership of the junior Orange Lodge and made it openly known on his appointment to the Northern Ireland office.
Stephen Woolman, QC, for Penguin, said its position was that the statement of playing a flute in an Orange Order band was, in its essentials, true and not defamatory.
Mr Woolman stressed that Mr Ingram was not relying on any innuendo, simply that the words themselves were defamatory.
"Playing the flute carries no obvious defamatory imputation ... it is not to the discredit of anyone that he plays the flute," he said.
"One can only get an allegedly defamatory meaning by establishing innuendo."
Mr Woolman said that even if the statement could be regarded as defamatory, it was about a period some 40 years ago.
"The passage of time must mean that the thrust of the libel is very substantially reduced, if there indeed is a libel," he said.
Lord Kingarth decided that he should refuse to grant an interim interdict. He said he had come to the view that the balance of the arguments favoured Penguin.
Having failed to prevent publication, Mr Ingram will consider whether to pursue a defamation action in which he seeks damages from Mr Galloway and Penguin. Mr Ingram was ordered to pay the full costs of the hearing.