At least three men disguised in burkas arrived in a rickshaw and entered the Peshawar Agriculture Training Institute on Friday morning.
All of the attackers were also killed, the army said. The Pakistani Taliban said they had carried out the attack.
The college was thought to have been closed for the Eid-e-Milad holiday.
One wounded student, Ahteshan ul-Haq, told Reuters that about 120 out of nearly 400 college residents were present during the attack, as most had gone home for a long holiday weekend.
“We were sleeping when we heard gunshots. I got up and within seconds everybody was running and shouting ‘the Taliban have attacked’,” he said.
Another student, Saleh, told the Dawn newspaper: “The terrorists shot at everyone who was roaming around and they were breaking doors down to attack students. Thankfully security personnel reached the hostel before those men came to our room – that is why we are alive.”
A Dawn reporter at the site said that suicide vests, three grenades, two bombs and a pistol were recovered from the institute building.
Peshawar, close to the Afghan border, has seen some of the worst violence during the Taliban insurgency in recent years.
In 2014 Taliban militants attacked an army-run school in Peshawar, leaving 141 people dead in one of the worst assaults in the country’s recent history. (Courtesy BBC)