Zena Edwards, 18, from Llandudno, spat at police officers and did not know who stabbed her in the back.
A teenager who was taken to hospital with a stab wound to her back refused to be treated by a doctor because he was black.
When the doctor tried to clean the wound Zena Edwards shouted: “You can’t clean it; you are dirty yourself.”
Edwards, 18, spat at officers who raided a flat where she was sleeping in Rhyl on May 6. When they noticed her stab wound she was taken to the A&E at Glan Clwyd Hospital in Denbighshire.
At Llandudno magistrates’ court District Judge Gwyn Jones told the 18-year-old: “A doctor working in hospital should not have to be subjected to such appalling behaviour.”
Edwards, of Llandudno, pleaded guilty to a racially aggravated public order offence, two charges of assaulting police officers and one of possessing a small amount of cocaine.
James Neary, prosecuting, said that Detective Constables Gemma Smith and Kelly Taylor-Jones, executed a search warrant at a flat in Rhyl, on May 6 and found Edwards asleep in a bedroom.
She had a stab wound to her back and, having clearly been drinking, became abusive when the officers stopped her going for a drink of water.
As they tried to put handcuffs on her she spat in the faces of both of them and threatened to headbutt them.
Edwards was taken to St Asaph police station and then to the emergency department at Glan Clwyd Hospital, where the abuse continued.
“Other patients were clearly alarmed,” said Mr Neary.
She then made the racist comments to the doctor who tried to tend her wound.
Andy Hutchinson, while defending her , said that Edwards had been at a party and had somehow been stabbed in the back although she did not know how because she was under the influence of alcohol and drugs.
“Nobody knows how she sustained the wound,” he said.
Edwards, he said, wishes to apologise to the doctor and others present.
“She is not a racist but it was a poor choice of words,” he added.
The District Judge said an immediate custodial sentence was justified as spitting in the officers’ faces was an extremely unpleasant act.
Edwards was given a 12-month community punishment and ordered to carry out 200 hours of unpaid work.
She was also fined £250 must pay the doctor and police officers £150 each in compensation as well as £85 in costs and an £85 surcharge.