Darren Jennings is on trial at the Old Bailey accused of misconduct in a public office around September 6, 2010.
Prosecutor Oliver Glasgow told jurors the former Wiltshire Police officer emailed a Sun reporter with information about his colleague Sergeant Mark Andrews, who had been arrested over his handling of a person in custody.
In the email, Jennings gave information about Sgt Andrews, who was married with children, saying he was well known for his promiscuity with colleagues.
The defendant also told the Sun reporter the sergeant had used excessive force towards members of the public at Salisbury Police Station, the court heard.
Asking for £10,000 for the information, Jennings told a Sun journalist: "I'm taking a massive risk in giving this information."
The story was never published and Jennings's contact only emerged after officers trawled the Sun's email database as part of the phone hacking investigation, the court heard.
Mr Glasgow said Jennings, 41, of Saffron Waldon, Essex, denies contacting the Sun saying he was "set up".
But the prosecutor said: "It is clear from the email sent by Darren Jennings to the (Sun journalist) that he was fully aware of the potential consequences of his actions. His attempt to suggest he has been the victim of a conspiracy which has seen one or more people plot against him to incriminate him is just as desperate as it sounds."
The trial, which is expected to last three days, was adjourned until tomorrow.