A student was arrested when he used "unparliamentary language" to gardai outside a pub.
Marcus Coffey (23), who is also a charity volunteer, verbally abused officers in a drunken episode on a south Dublin street.
Judge Michael Walsh struck the case out, leaving him without a conviction, after he paid €200 to charity.
Coffey, of Birchfield Heights, Goatstown, Co Dublin, pleaded guilty to public drunkenness and threatening, abusive and insulting behaviour.
Sgt Gail Smith told Dublin District Court that the incident happened outside McSorley's pub in Ranelagh on June 17.
It was "well past closing time" and gardai were involved in moving on a number of men from the area, she said.
When approached, Coffey said to gardai: "F**k off, I don't have to give you anything."
He refused to comply with a garda's directions to leave the area and was arrested.
He had no previous convictions.
Coffey was in his final year in DIT, where he was studying logistics and supply chain management, his lawyer said.
"It was unparliamentary language, I think, that caused offence," said Judge Walsh.
His lawyer said the defendant was apologetic and "quite nervous" to be in court.
He was involved in voluntary work for the ARC Cancer Support organisation.
He was willing to pay a charity contribution to avoid conviction, his lawyer said, adding that Coffey was unlikely to ever come before the court again.
The defendant confirmed to the judge that the charity he worked with was registered.
"You can see the trouble drink will get you into," said Judge Walsh, before striking the charges out.