Government Railway Police sources said E Jaya Gopi, the accused, was drunk at the time.
He took the woman to an AC compartment on the pretext of collecting the fare difference, and allegedly made a pass at her.
She shouted for help and other passengers came to her rescue.
The 23-year-old woman had boarded the train in Chennai with a general ticket and had approached the accused for a reserved berth, said Gudur GRP Sub-Inspector K Srinivaschary.
Gopi was taken into custody at Gudur railway station and booked on the charge of outraging the modesty of a woman.
Railway authorities later suspended him from service.
Photos: Tamannaah Bhatia sizzles in metallic gown
Photos: Arjun Kapoor and Raj Thackeray at event in Mumbai
In pictures: Here are the fastest ODI centuries in cricket history
'Shaadi No. 1': 10 famous Bollywood weddings in pictures
Photos: Shah Rukh Khan, Shweta Bachchan at Karan Johar's book launch