Washington is recruiting in Syria for an offensive against Raqqa, the capital of the self-styled Islamic State. Unfortunately, the Syrian Kurds behind most of the success in the advance on Raqqa are . . . getting bombed by America’s NATO ally Turkey.

The Pentagon’s warned that Raqqa needs to fall fast, since terror attacks against the West are being planned there. But Turkish President Recep Tayyip Erdogan says: “We are putting [further intervention] on our agenda . . . to remove the threat against our country.”

What threat? Since he reopened Ankara’s longtime war on Turkey’s own Kurdish minority, Erdogan’s worried about gains by Syrian Kurds of the YPG, or People’s Protection Units.

Ankara sees the YPG as an arm of the PKK, the Kurdistan Workers’ Party, regularly accused of terrorist tactics in its decades-long insurgency. Washington sees it as a vital ally against ISIS.

“The facts are these: The only force that is capable [of taking Raqqa] on any near-term timeline are the Syrian Democratic Forces, of which the YPG are a significant portion,” Gen. Stephen Townsend, who heads the international anti-ISIS coalition, told reporters Wednesday.

But Erdogan plainly doesn’t care: He’s been bombing YPG units for weeks now and threatens ground combat.

In the operation Ankara calls “Euphrates Shield” (after the river that runs through Turkey, Syria and Iraq), Turkey aims to advance on the Syrian border town of al-Bab (held by the Islamic State), then march to Manbij, recently liberated from the terrorists by a YPG-led Syrian militia.

There’s more: Erdogan is also demanding “a place at the table” in the ongoing fight in Iraq to free Mosul from ISIS.

He’s already got troops nearby, uninvited — certainly not by the Iraqis whose territory he’s violated. Asked by Washington and Baghdad to pull out, he threatened to send in more.

He may plan to stay: Erdogan’s also announced that Turkey will no longer “voluntarily accept the borders of our country” — a clear reference to his country’s claim to Mosul dating back to 1920.

In the past, Erdogan’s been all bluster, no action. But his recent moves are already Turkey’s most aggressive since the 1974 invasion of Cyprus. His response to the recent failed coup attempt has been to essentially end Turkish democracy, so all bets are off.

At a minimum, Erdogan could undermine the effort to crush ISIS — but the risks run all the way to triggering a regional war.

All this from a guy who just a few years back was widely known as President Obama’s favorite leader in the Muslim world.