The incident took place on July 2 but a case was filed later after a medical examination.
According to the girl's parents, she expressed discomfort and was taken to the hospital where it was confirmed that she was raped.
Several parents are protesting outside school accusing the school of not taking any action.
Bangalore Additional Commissioner of Police (Law and Order) Kamal Pant said that the alleged incident took place inside the school.
She was allegedly assaulted when she came out of her class at around 11 AM on Monday.
Two people have been taken into custody after the girl's parents filed a police complaint.
Police officials have invoked Section 4 of Protection of Children from Sexual Offences (POCSO) against the unidentified person and registered a complaint of rape.