I'm slightly confused. You say in the question the teacher is male ("he noticed that"), but I can't figure it out without the teacher being female. On the off chance the teacher is a woman dressed as a man or something, I got it to work like this:
4 3 8
9 5 1 <-- With this one being boy, girl, boy, and why it won't work with a male teacher
2 7 6
So, the highest mark for a boy would be 9. If the teacher really is male, though, I can't yet come up with the right arrangement, and unless I'm missing something, I can't think of one there could be. 3 needs to be across from 7, and neither 3 nor 7 can be in the same row as 9, so 3 and 7 can't be on the diagnols, and thus neither can 1 or 9. If 3 and 7 are vertical, like I have them, 9 and 1 are horizontal, but if the teacher is male, those are both girls, and they can't score less than 1. So, if 3 and 7 are horizontal, 9 has to be in the top row, since that's the girl's row, and can't have the 1. The problem there is the 2 and 4 have to be next to 9 (Since 8 or 6 is too much), and that puts 2 in the girl's row, which again breaks the rule.
Oh, and how I got the numbers in the first place: From 1-9, every number has a pair that adds up to 10, except for 5 (i.e. 1+9, 2+8, 3+7, 4+6, 5), so I put 5 in the middle, and all the pairs on either side, so they'd add up to 15 all around. Getting them spun the right way was trial and error.