President Trump told Spain’s foreign minister that he had a sure-fire plan to prevent asylum seekers from Africa from flooding European shores — build a wall in the Sahara desert.

Foreign Minister Josep Borrell, a former president of the European Parliament, revealed that Trump told him that a border wall in the desert — like his long promised wall on the Mexican border — would work for Europe as well, The Express reported.

The Spaniard did not reveal when the commander-in-chief floated the plan, although other sources said it was in June when he flew to the States during the White House visit of Spain’s King and Queen.

Borrell mentioned Trump’s Saharan solution — in which Spain and other European countries would apparently have to construct the barrier on foreign soil — during a lunch in Madrid organized by the cultural association Club Siglo XXI.

The Spanish daily El Pais said the minister made it clear he disagreed with Trump’s proposal.

Spain has overtaken Italy and Greece as a popular entry point for migrants, with most coming from Morocco, Guinea and Mali.

Trump’s call for a wall on the southern border — which he repeatedly insisted that Mexico would pay for — was a hallmark of his presidential campaign, with “Build the Wall!” chants still breaking out at his frequent “MAGA” rallies.

But Mexico has flatly told the president that it won’t spend a dime on his wall, and Congress has refused to cough up much cash for it.

The Senate this week passed a spending bill to avoid a government shutdown that included no new funding for the barrier.