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: Varun, Taapsee, Jacqueline promote 'Judwaa 2' on 'Dance Plus 3'
Photos: This is how Chitrangda Singh looks without make-up
Photos: Malaika Arora parties wearing see-through lace dress
When exes Ranveer Singh and Anushka Sharma met at GQ Awards 2017
Photos: Mira Rajput visits a clinic in Bandra