A senior military spokesman in Peshawar, the province's capital, said earlier on Wednesday that a man had detonated a bomb killing himself and 10 to 15 soldiers, but later reports put the toll at 30.
Major-General Shaukat Sultan said: "It was a training area. It was a suicide attack. The bomber wrapped a chadar [cloak] around his body and came running into the training area and exploded himself where recruits had gathered for training.
"Ten to 15 recruits have been martyred," he said.
According to the same source, the bomb went off on a parade ground next to an army camp in the town of Dargai.
There was no immediate claim of responsibility for the blast.
Dargai is a known stronghold of an Islamist group that has links to al-Qaeda.
Only last month, security forces attacked a madrasa, or religious school, run by the group in a tribal area near the Afghan border that killed about 80 suspected militants.