Umair Ashrafi, hailing from Tanur in neighbouring Malappuram district, was also accused of smearing chilli powder on the private parts of the boy, alleging disobedience, they said.
As the student lodged a complaint with the police recently, the accused fled from the state and was staying in hideouts in various places in Karnataka and Tamil Nadu.
Based on a tip-off that he was coming to his home district from Coimbatore in Tamil Nadu, a police team reached Tanur and waited for his arrival on Thursday. Though Ashrafi tried to run away on seeing the police, he was later caught.
Kannavam police arrested him and booked him under relevant sections of the Bharatiya Nyaya Sanhita (BNS).
Ashrafi was produced before a local court here which remanded him to judicial custody on Friday, police added