Patrick Dignam (48) was behaving in a "highly erratic and volatile" manner when he was arrested for public order offences, a court heard.
Judge Bryan Smyth jailed him for three months but made the sentence concurrent to a prison term the accused was already serving, after hearing he had mental health problems.
Dignam, of Kimmage Road Lower, pleaded guilty to threatening, abusive and insulting behaviour and garda obstruction.
Dublin District Court heard the incident took place at Henry Street on February 28.
The prosecuting garda said he was on duty at 8pm when he saw the accused "walking down Henry Street completely naked".
When Dignam was approached, he shouted profanities and abuse at the garda, then attempted to throw a punch at him.
Dignam had to be physically restrained and put in handcuffs as he was arrested. His behaviour at the scene was "highly erratic and volatile", the court heard.
Judge Smyth asked what the accused's level of intoxication had been. The garda said Dignam's pupils had been dilated and he was "making no sense whatsoever". The accused was suffering "significant mental health difficulties", his lawyer said. The garda said he was not aware of this at the time.
Dignam had 55 previous convictions and was already serving another sentence when he appeared in court.
The primary reason for the offences was that Dignam was a person with diagnosed paranoid schizophrenia and at the time he had stopped taking his medication. His behaviour on the day was a reaction to this and he was not under the influence of any substance, the lawyer said.
Dignam had been a heroin user but was clean since he had gone into custody.
He had good family support when he was not in custody.
The accused had been stable for a number of years but went into "a decline".
He was now making progress again, the lawyer said.
The judge said he would impose a sentence, but it would run concurrently from the date of conviction.