The United States will recognise the Somali government in Mogadishu, ending a diplomatic hiatus that has lasted more than 20 years, a senior US official said.

US secretary of state Hillary Clinton will announce the shift during a meeting on Thursday with visiting Somali president Hassan Sheikkh Mohamud, whose election last year marked the first vote of its kind since warlords toppled military dictator Mohamed Siad Barre in 1991, assistant secretary of state Johnnie Carson told reporters on Wednesday.

"When the secretary meets with Hassan Sheikh tomorrow, she will exchange diplomatic notes with him and recognise the Somali government in Mogadishu for the first time in 20 years," Carson told a news briefing.

The US never formally severed diplomatic ties with Somalia, whose slide into anarchy was highlighted by the 1993 "Black Hawk Down" incident which saw militia fighters shoot down two US military helicopters over Mogadishu.

In subsequent years, Al Qaeda-linked Al Shabab insurgents seized control of large areas in the south and central parts of the country before Ethiopian, Kenyan and African peacekeeping (AMISOM) troops began a long, US-supported counter-offensive aimed at restoring order.

The formation of the new government, led by Mohamud, is the culmination of a regionally brokered, UN-backed effort to end close to two decades of fighting that has killed tens of thousands of people.

Carson said the US decision to formally recognise the new government underscored the progress toward political stability that Somalia has made over the past year, including "breaking the back" of Al Shabab's insurgency.

"We are a long way from where we were on October 3, 1993 when Black Hawk Down occurred," Carson said. "Significant progress has been made in stabilising the country, in helping to break up and defeat Al Shabab."

"Much more needs to be done, but we think enormous progress has been made and we have been at the very centre of this in our support for AMISOM."