As Al Jazeera English explains:
Ahmadinejad sacked the country's intelligence chief, Heydar Moslehi last month, in a move that Khamenei quickly overruled, reinstating Moslehi.
Following the move, the president effectively went absent without leave, skipping cabinet meetings for 10 days in anger over the reinstatement.
AJE reports Ahmadinejad returned to work May 1st, but there's been some speculation that he could still resign.
Analyst Mehrdad Khonsari, with the Centre for Arab and Iranian Studies in London, explained to AJE that the controversy "shows the level of disunity at the very top of the Iranian [political] hierarchy [with] Ahmadinejad having already polarised the internal political scene as a result of fraudulent election results that were announced more than 20 months ago."
Ed Note: An earlier version of this post incorrectly noted Ahmadinejad's Chief of Staff as having been arrested.