A third person on the same motorcycle was injured, and has been referred to the capital for treatment.
The accident took place at Harishchar rail crossing area of the upazila on Sunday.
The deceased were identified as Md. Rony (25), a CNG-autorickshaw driver and son of Md. Joynal Abedin of Padua village of Perul North Union, and Nazrul Islam (27), a confectionery owner and son of Rafiqul Islam of Shanichon village.
Officer-in-charge (OC) of Laksam Railway Police Station Jasim Uddin Khandaker said besides the two deaths another person was injured in the same accident.
According to locals, on Sunday afternoon, three friends left for Harishchar crossroads from Harishchar-Bhuschi road on a motorcycle. Rony died on the spot when their motorcycle was hit by the Chattogram-bound Karnafuli train while making an illegal rail cross violating the red signal in Harishchar crossing area.
Seriously injured Nazrul was taken to a private hospital in Laksham where the doctor on duty declared him dead. Another injured, Kabir Hossain has been sent to Dhaka for advanced treatment.