Judge R P Sharma also imposed fine of Rs 7,000 on Mohd Sadik (38), the accused.
Prosecutor Vishal Anand Srivastav said the prosecution examined ten witnesses in the case.
The incident had taken place in Badgonda police station limits on June 5, 2011. The girl was raped at her house when her parents were away at work.