Gurpal Virdi, 56, of Hounslow, west London, was acquitted by the jury at Southwark Crown Court.
Mr Virdi had denied indecently assaulting a male prisoner and misconduct in public office.
The charges dated back to on or before 7 November 1986.
During the trial Mr Virdi accused the Metropolitan Police of bringing the criminal case against him as part of a 17-year campaign to "hound" him out of the force.
The retired detective claimed the police had tried to discredit him after he gave evidence to the Stephen Lawrence inquiry about racism within the police force.
He told jurors: "This is a typical reaction from a department that has hounded me since 1998, investigating me and following me around and bugging my phone.
Mr Virdi retired from the Metropolitan Police in 2012 after 30 years of service.
A former Metropolitan Police officer has been found not guilty of sexually assaulting a teenage boy in the back of a police van nearly 30 years ago.