Former City Councilman Dan Halloran says he was never a crooked politician — and he has his own secret tape to prove it.

While federal officials were building a corruption case against Halloran, the Queens politician secretly made a recording of a meeting he had with a dairy executive who was allegedly trying to buy influence from him.

The February 2013 recording captured the voices of Halloran and Bob Schwartz, heir to the Elmhurst Dairy fortune, a failed candidate for Queens borough president and other local offices, who wanted to become a city commissioner.

“Bob, you’re putting me in a very bad place,” Halloran said in the recording, played for jurors Tuesday at Halloran’s corruption trial in White Plains. “No one person is buying a vote and that’s what this boils down to.

“I can’t promise you that, a particular job like a commissioner. I can’t help you violate campaign finance law. What I’m not willing to do Bob is make it look like a quid pro quo where somebody is buying their way into office.”

Halloran’s lawyer, Vinoo Varghese, said Schwartz’s brother had offered to wire Halloran $100,000 if Schwartz would be given a job in Halloran’s office, providing him entry into City Hall.

Varghese said the recording was proof that Halloran was not predisposed to accepting bribes, as the government contends.

“He knew it was a bribe, so he recorded it,” Varghese said of Halloran’s decision to tape the meeting. “Dan would not take a bribe, he never took a bribe and this is clear evidence. This shows he was not predisposed.”

Halloran is accused of pocketing $20,500 in cash bribes for masterminding cross-party negotiations to help fix the Republican mayoral primary for state Sen. Malcolm Smith.

Halloran is also facing charges of allegedly pocketing $18,300 in cash bribes and $6,500 in straw-donor campaign donations for agreeing to steer $80,000 of council discretionary funding for his district to a company he believed was controlled by those who paid him the bribes.

Halloran faces up to 45 years behind bars if convicted. Smith heads to trial in January.