Ahmed Faud, a doctor at the main hospital in Baquba, the provincial capital, confirmed he had received 20 dead bodies.
"The bodies are riddled with bullets," he said.
He said that the dead policemen included three officers - a colonel, a lieutenant colonel and a captain.
An official said: "They were in three vehicles when several armed men ambushed and killed all of them."
Diyala is considered to be one of the most dangerous of Iraq's 18 provinces.
Several suicide bombings have taken place there in the past few months.
On September 15, a female suicide bomber killed 22 people and injured dozens more after exploding a bomb during a feast in the town of Balad Druz in Diyala.