The blast shattered nearby shop windows in the residential suburb.
Sayed Mohammad Amin Fatemi, the public health minister, said: "At this time I can tell you that 31, almost all of them military personnel, have been martyred."
Fatemi also said that 17 of the wounded were in a critical condition.Easy target
The attacker detonated explosives strapped to his body as he approached the bus, the ministry said in a statement.
Al Jazeera's Alan Fisher in Kabul reported that the blast was so loud it could be heard across the city.
Fisher said: "This was a very busy intersection. The bus was travelling through the town, picking up army personnel from a number of checkpoints."
He also said that the Taliban targets the Afghan army and police because it is easier to reach them than foreign forces operating in the country. The Taliban says it will continue to target them.
Hamid Karzai, the president, called for "stronger vigour" worldwide after this latest bombing.
Karzai said: "It was an act of extreme cowardice on the part of those that committed it. The person who did this was against humanity, and against Islam."
The attack is the deadliest in Kabul since an explosion on a police bus in June that killed as many as 35 people.
Mohammad Azim, a police officer at the scene, said: "For 10 or 15 seconds, it was like an atom bomb - fire, smoke and dust everywhere," Azim said.
|People gather at the blast site |
as a clear up operation starts [Reuters]
Sulahdin, an army officer at the scene who goes by one name, said there were more than 50 people on the bus at the time of the explosion.
One witness, Ahmad Jaweed, told Al Jazeera that he saw several corpses belonging to military personnel being removed from the site, along with local residents.
Television pictures had also showed soldiers being pulled from the wreckage.
Some of the dead were still in their seats.Month of 'operations'
Zabihullah Mujahed, a Taliban spokesman, said the attack was part of Operation Nasrat (Triumph), a military campaign launched during the holy month of Ramadan.
There have been more than 100 suicide attacks in Afghanistan this year, many blamed on the Taliban.
While most attacks occur in remote areas in the south and east of Afghanistan, there have been a series of blasts inside Kabul this year.
This attack was the first inside the heavily patrolled capital since a suicide bomb struck a Nato armoured vehicle on September 21, killing a French soldier and wounding several Afghans