Bob Madison thought he might face sneers from opponents of gentrification when he and his husband bought a Harlem brownstone six years ago — but he didn’t expect to be tossed in jail.

The p.r. exec and his spouse, both white, have announced plans to sue the city for $5 million, claiming Madison was falsely arrested on a fabricated hate-crime allegation after a quarrel with a politically connected state employee.

“This is a blatant case of [someone] using the legal system, with the help of his political, Police Department and district-attorney connections, to persecute Bob Madison, an innocent man,” said Madison’s attorney, Robert Sharron.

Madison had clashed with Willie Walker, a black Harlem resident, on Nov. 28, 2012, in front of the couple’s West 126th Street building.

Walker, a former community-board chair and one-time City Council candidate, is the superintendent for the Adam Clayton Powell State Office Building, located behind the home.

Madison and his husband, Russell Frost, claim Walker flew into a rage when the men complained that his workers had dumped debris in front of their building.