Robert Stewart was discovered in his room by two cleaners at the Aberley House Hostel in Ayr, south west Scotland, in October last year.
On Wednesday Mr Stewart admitted to sexual breach of the peace in Ayr Sheriff Court, where depute fiscal Gail Davidson described how he had been found by the hostel workers.
She said: "They knocked on the door several times and there was no reply.
"They used a master key to unlock the door and they then observed the accused wearing only a white T-shirt, naked from the waist down.
"The accused was holding the bike and moving his hips back and forth as if to simulate sex."
Both witnesses, who were extremely shocked, notified the hotel manager, who in turn alerted the police.
Mr Stewart was placed on the sex offenders’ register but his sentence was deferred until next month.
He is not the first man to be convicted of a sexual offence involving an inanimate object, however.
Karl Watkins, an electrician, was jailed for having sex with pavements in Redditch, Worcs, in 1993.
Intreb si eu: bicicleta era ruseasca?