A young partygoer who assaulted two paramedics after consuming "a cornucopia" of drugs at Victoria's alternative Rainbow Serpent Festival has avoided a mandatory jail sentence.

James Haberfield, 22, became the first person under new Victorian laws on Wednesday to be slapped with mandatory treatment and monitoring for offenders who attack emergency workers.

However, he avoided a minimum six-month jail term also required under the new laws, which came into effect last October.

On January 29 this year, Haberfield returned to Melbourne after the four-day music and arts festival during which he consumed "a cocktail of drugs" including ecstasy, ice, MDMA and ketamine.

Haberfield was given an 18-month community corrections order and must undergo mandatory treatment. Credit: AAP

He knocked on the door of a Coburg home, walking inside and terrifying the residents, who he did not know.

An ambulance went to collect Haberfield, staffed by one male and one female paramedic.

'Acutely psychotic'

While he was being cared for in the rear of the vehicle, and in an "acutely psychotic state", he became aggressive, punching paramedic Monica in the face, wrapping his arms around her and squeezing.

The paramedic screamed as Haberfield pinned her to the rear corner of the ambulance, with the two paramedics pressing their duress button before escaping and calling police.

More on 7NEWS.com.au

The paramedic driving the ambulance sedated him with midazolam before he was taken to Royal Melbourne Hospital, where he underwent treatment for more than a week.

Magistrate Simon Zebrowski said Haberfield's impaired mental state that day wasn't solely due to self-inflicted intoxication as he had pre-existing autism spectrum disorder and a major depressive disorder.

Monica spoke outside court after James Haberfield avoided jail for assaulting her whilst under the influence of drugs. Credit: AAP

A psychiatric expert said he would have an elevated risk of suicide while in custody.

Instead, Mr Zebrowski said sending the "mortified, dismayed and deeply ashamed" young man to jail "would have a disproportionate and catastrophic effect" on his future.

Monica was emotional outside the court on Wednesday. Credit: AAP

Haberfield was given an 18-month community corrections order and must undergo mandatory treatment.