It was the latest in a series of insider attacks that have undermined trust between coalition and Afghan forces.
The latest killings, which occurred at a remote Afghan police outpost in the eastern province of Ghazni, are the worst in a string of attacks in recent months.
Mohammad Hassan, Ghazni's chief police detective, said: "An infiltrated local policeman first drugged all 17 of his comrades, and then called the Taliban and they shot them all.
Seven of the victims were new recruits, officials said.
The Taliban claimed responsibility.
There is mounting pressure to contain the Taliban insurgency before most Nato combat troops withdraw by the end of 2014.