Prime Minister Mohamed Hussein Roble’s office said the African Union representative Francisco Madeira must leave within 48 hours.
The prime minister’s office said the order came because Madeira was engaging in acts incompatible with his status.
But did not give details of what Madeira had done.
President Mohamed Abdullahi Mohamed’s office said in a post on Twitter that Roble’s order was an illegitimate and reckless decision from an unauthorized office.
It said it did not endorse any illegal action action against Madeira.
And added that it was the custodian of Somalia’s sovereignty.
The expulsion order looks set to worsen a political dispute between Roble and Mohamed.
The two have had a long-running dispute.
Last December, Mohamed tried to suspend Roble’s powers for suspected corruption – something Roble denounced as a coup attempt.
And recently the focus of their rivalry has been Somalia’s parliamentary elections, scheduled to end this month.
The latest rift has raised fears that it will distract from a campaign against the al Shabaab militant group.
African Union peacekeeping troops help the government fight al Shabaab.
Madeira, who is from Mozambique, was not immediately available for comment.