Democratic mayoral candidate Sal Albanese said Wednesday that the best way to solve the city’s homeless crisis is by slapping a hefty tax on foreigners who own prime real estate in the Big Apple.

Saying that Mayor de Blasio has failed miserably in trying to resolve “a crisis on steroids,” Albanese suggested an extra tax on luxury real estate owned by people whose primary residence is outside the US.

The revenues going towards building affordable housing.

“This is a politically viable solution to address homelessness in New York City,” said Albanese, a former councilman.

The de Blasio administration toyed with a similar plan in 2014, but ran into opposition from the real estate industry.

Albanese said he’d like to model his plan off a long-dormant bill introduced by state Sen. Brad Hoylman (D-Manhattan), which called for an annual surcharge of 0.5% to 4% on apartments worth more than $5 million owned by non-city residents.

Jaclyn Rothenberg, a de Blasio spokesperson, said the “mayor is building more affordable housing than any mayor before him.”