When a learner is placed in a school of the opposite gender (boys school or girls school), then it means that there was wrong selection of gender during registration at the school level.
The child's parent should visit the respective county director of education to have the issue addressed. The primary school should also write to KNEC to have the mistake corrected