Mayoral hopeful Bill Thompson yesterday compared the NYPD’s use of stop-and-frisk to the racial profiling that led to the tragic killing of Trayvon Martin in Florida.

The analogy, regarding the shooting of 17-year-old Martin by neighborhood watchman George Zimmerman, was Thompson’s strongest criticism of the stop-and-frisk tactic to date.

“Here in New York City, we have institutionalized Mr. Zimmerman’s suspicion with a policy that all but requires our police officers to treat young black and Latino men with suspicion, to stop them and frisk them because of the color of their skin . . . profiled as Trayvon was profiled,” Thompson said in a speech at a Brooklyn churcg. “If our government profiles people because of skin color and treats them as potential criminals, how can we expect citizens to do any less?”

Before yesterday’s stop-and-frisk statement, Thompson, the lone black candidate for mayor, has garnered criticism from activists — including the Rev. Al Sharpton — for not standing firmly against the controversial NYPD practice.

While he has been somewhat critical of the implementation of stop-and-frisk, Thompson didn’t support either of the two City Council bills that are aimed at restricting the practice.

Instead, he’s insisted a change in leadership of the city in January would resolve the issue.