President Barack Obama never uttered Donald Trump’s name during a speech in India on Friday — but still drew laughs for veiled, deadpan digs at the president’s Twitter habit by warning leaders to think before they use the social media service.

“Have a little bit of an edit function, think before you speak, think before you tweet,” Obama said at the Hindustan Times Leadership Summit in New Delhi, The Hill reported.

The comments came two days after Trump retweeted violent anti-Muslim videos from the Twitter account of the leader of a British ultranationalist party.

Obama was riffing off comments former first lady Michelle Obama made this week in which she offered her own advice on using the tweeter-in-chief’s favorite platform — saying it is “never a good idea” to put your first thought in the morning on social media.

“I think she was just giving a general advice, the same advice that you used to hear from your mother generally: Don’t say the first thing that pops in your head,” the two-term leader told the conference.

Obama didn’t take the bait when asked repeatedly Friday about his shoot-from-the-hip successor, sticking to a general warning to all high-profile figures to take care.

“I think it’s important to be mindful of both the power of these tools but also its limits,” Obama said when asked about the dangers of Twitter.

“What I would say is Twitter, Facebook, WhatsApp — all these various platforms are extraordinarily powerful tools, and those tools can be used for good and the tools can be used for ill,” he said.

Obama also noted that he has about 100 million Twitter followers, a not-too-subtle swipe at Trump, who has just under 44 million.

He was more direct in assailing Trump’s threat to withdraw from the 2015 Paris climate accord on slashing global carbon emissions.

“The (Paris) agreement that — even though we have a little bit of a pause in American leadership — is giving our children a fighting chance,” Obama said.

“I can have a debate with someone about climate change and about what we need to do, but if you call climate change a hoax, I don’t know what to do with that,” said Obama.

During the presidential campaign, Trump famously said climate change is a hoax perpetrated by China.

With Post wires