A court heard how four officers suffered injuries when they were called to Matthew Labbee's home in Potternewton, Leeds.
The officers were called to the property on Newton Garth on August 6 last year after Labbee, 27, dialled 999 to say he had been the victim of a sexual assault.
Leeds Crown Court heard the officers arrived to find him naked sitting on a child's see-saw in the garden, dismantling a mobile phone.
One of the officers went to help Labbee but he picked up a bamboo cane and struck the PC to the side of the head and neck.
He then picked up a plastic picnic table and struck another officer with it.
Labbee had to be tasered during a struggle but the Phd student continued to become aggressive.
Bashir Ahmed, prosecuting, said a spit hood had to be placed over Labbee's head during the incident.
The court heard two of the officers had to undergo blood testing for HIV and hepatitis.
They faced an agonising waiting for months before being given the all-clear
In a victim statement read to the court, one officer said: "I feared I may have a life-threatening disease.
"I had been told that the chances of being infected were very low but this did not help me at all.
"I considered leaving the police because of the impact this had on myself and my family.
"My wife cried when I told her about the consequences."
Labbee pleaded guilty to two offences of assault occasioning actual bodily harm.
Mr Smith said Labbee is a Canadian national who had come to West Yorkshire to complete his university studies.
The barrister said Labbee had a history of drug and alcohol abuse that led to a self-destructive pattern of behaviour.
Mr Smith said the incident happened on the day of the Pride celebrations in Leeds city centre.
The court heard the defendant's partner had walked out on him and he attended the event alone.
Mr Smith said Labee took three men back to his home and one of them gave him a white powder which he believed to be the drug Mkat.
He added: "Given the reaction of the defendant he doesn't believe the drug provided to him was the drug he ingested. It had an effect on his mental state."
Mr Smith explained that Labbee had been dismantling his mobile phone as he feared it had been bugged.
He said : "Thankfully, no officers required retro-viral drug treatment.
"That does not diminish the understandable fear that they would have had."
Labbee was given an 18-month prison sentence, suspended for two years.
He was also ordered to do 200 hours of unpaid work and pay £1,000 to each of the two officers as compensation.
Judge Simon Phillips, QC, said: "This is an unusual and troubling case.
"You had voluntarily ingested illicit drugs.
"That is a significant factor in terms of your culpability.
"It was highly irresponsible for you to have done that