“I wish you a safe and pleasant journey,” Mr. Obama said in their phone call on Friday, according to an account of the call published on Mr. Rouhani’s Twitter page, “and apologize if you’re experiencing the [horrendous] traffic in N.Y.C.”

The post was later deleted. But a White House official confirmed Mr. Rouhani’s account.

Some details remain murky. It is unclear, for instance, if Mr. Obama characterized the traffic as “horrendous” or if the word, bracketed in Mr. Rouhani’s retelling, was an editorial aside from the Iranian president.

“This is always the worst week of the year for traffic in Midtown,” Samuel I. Schwartz, a former city traffic commissioner, said in a phone interview. “The president of Iran, the next time he visits, unless he comes during Christmas week, would find the traffic moving a lot easier.”

It would be understandable if residents became defensive at the remark by Mr. Obama, a man whose expected presence can grind entire neighborhoods to a halt.

But the city’s traffic is a well-worn punching bag, pilloried long before the United States and Iran slid into diplomatic gridlock.