Robert Stewart was allegedly caught in the act by two terrified cleaners who walked into his bedroom in a hostel.
Stewart has denied the accusation, claiming it was caused by a misunderstanding after he had too much to drink.
The 51-year-old bachelor was charged with the bizarre sexual offence after he was disturbed by the cleaner and her colleague in a private hostel in Ayr.
The charge alleges he conducted himself in a disorderly manner, simulated sex with a bicycle and continued to do so while naked from the waist down in the presence of two female employees.
Stewart had been living in the Aberley House hostel from October 2006 after moving from his council house in Girvan, Ayrshire.