Quizzed over why he soiled the cell, Ryan replied "I didn't realise there was a toilet here".
Asked by the officer "Do you do this at home?", he said "Yes I do, f*** off you c****".
In a police interview later Ryan confessed that he had drunk a vodka and tonic and a rum and Coke at the party, but insisted he thought he was OK to drive.
Instead he blamed his behaviour on mixing antidepressant medication and antibiotics with the alcohol and said he thought his drink might have been spiked.
Ryan pleaded guilty to the charges, but defence lawyers blamed the troubled star's outburst on the stress he has been under since he left the Celebrity Big Brother house in January this year.
Wearing a three-piece dark grey suit, white shirt and black tie with his blond hair quiffed, the singer nodded as his sentence was read.
Ryan was told his two-year driving ban would be cut to 18 months if he completes a drink-driving course.
In a statement released after the sentencing, the singer thanked his fans for their support.
It said: "Lee respects the court's decision today and takes full responsibility for his actions.
"This has been an important lesson for Lee as he works towards a healthier and happier new chapter in his life."