A father-of-three threatened to slit a female garda's throat when she stopped and questioned him on an inner city street.
Gareth Lynch (39) was "not a good example" to the young children who were bystanders as he also threatened to headbutt the officer and shouted insults at her.
Dublin District Court heard it "wasn't a very pleasant experience" for the garda, who "bore the brunt" of Lynch's aggression on the day.
Judge Bryan Smyth spared him jail, giving him a two-month suspended sentence.
Lynch, of Pearse House in central Dublin, pleaded guilty to threatening, abusive and insulting behaviour and failing to comply with garda directions.
Garda Maria Harmon said she was on duty on Sheriff Street on January 7 last year when she saw three men being approached by another at the junction of Crinian Strand.
She became suspicious, and when she approached them, Lynch called her a "g** bag c**t" and said he would "slit my throat", she told the court.
Gda Harmon told him he would be arrested and he said he would headbutt her and moved towards her.
Members of the public were in the area at the time, she said.
The garda had "borne the brunt" of Lynch's aggression, but he came before the court a "very different person", his barrister Donal Pattison said.
Lynch could not recall the incident and was "shocked" at the evidence when his lawyer went through it with him.
He apologised in court and said: "I can't even remember that day."
Lynch had a drug dependency but was tackling this, Mr Pattison said. The garda had been a victim of the accused's addiction on the day.
"It wasn't a very pleasant experience for Garda Harmon to be called these names," Judge Smyth said, "and not a very good example to the young children who I understand were present."