The bus was travelling to Nairobi when it was stopped in Mandera county, not far from the Somali border.
The Somali gunmen separated out non-Muslims by asking passengers to read from the Koran, officials and witnesses said. Those who failed were then shot in the head.
Al-Shabab has carried out a series of attacks in Kenya since 2011.
A statement on a website linked to the Islamist group carried a statement saying the attack was carried out in retaliation for security raids on mosques in the coastal city of Mombasa earlier this week.
Kenyan interior ministry said on its Twitter feed that a camp belonging to the attackers had been destroyed by Kenyan military helicopters and jets, with “many killed”.
More than 60 passengers were on the bus when it was attacked, before dawn on November 22, about 19 miles from Mandera town.
The driver tried to accelerate away, but the vehicle became stuck in mud caused by recent heavy rains.
About 10 heavily armed men talking Somali ordered the passengers off the bus.
Kenya’s Red Cross said emergency workers were trying to retrieve bodies from the scene.
Security agencies were “in pursuit of the criminal gang” that carried out the attack, the interior ministry said. It described the assailants as “bandits”.
A local official quoted by Kenyan media said the government had failed to answer their pleas for extra security.
The attack comes after a week of heightened tension in Mombasa, which has suffered a series of al-Shabab attacks.
Security forces raided mosques in the city, saying they were being used to store weapons. The raids triggered apparent revenge attacks by Muslim youths.
Kenya has experience a series of al-Shabab attacks since it sent troops to Somalia three years ago to help fight the militant group.
Mandera, a remote area in Kenya’s north-east that shares a long and porous border with Somalia, has been one of the regions worst-affected by the violence.
On the Somali side of the border, al-Shabab is said to have a base that was recently bombed by Kenyan warplanes. It was not immediately clear whether this was the same base targeted by Kenya following Saturday’s attack.
dy4QeQb7KYcAt least 158 people have died in Spain's worst flooding disaster in generations. On October…
Google has been fined two undecillion (a two followed by 36 zeroes) roubles by a…
Embarking on a home remodel is an exciting journey, promising enhanced comfort, increased property value,…
The US presidential candidates continued to campaign across key swing states on October 20. Footage…
Elon Musk has said he will give away $1 million a day to a registered…
India and Canada have decided to expel their top envoys along with other diplomats as…