How can he love for his brother what he loves for himself when he wants to get the highest marks in the exams?
Question

I am a student in school, and I always try hard to get the highest marks. But how can I love good for my competitors among the other top students like what I love for myself, because if I love for them to get the highest marks, it is as if I am putting myself in a position that is not the top. Please advise me.
Praise be to Allah.Al-Bukhaari (13) and Muslim (45) narrated from Anas that the Prophet (blessings and peace of Allah be upon him) said: “No one of you truly believes until he loves for his brother what he loves for himself.”
Undoubtedly a person will love for himself the highest status, and will compete with others for that. Hence the scholars said that what is meant is loving good for one’s brother in general terms, and loving that he be spared ills, and there is nothing wrong with loving for oneself to surpass others in virtue and achievements.
Ibn al-Jawzi (may Allah have mercy on him) said in Kashf al-Mushkil min Ahaadeeth as-Saheehayn (3/231):
If it is said: how can this be understood, when everyone seeks precedence in what he chooses for himself, and loves to surpass others in virtue, and ‘Umar competed with Abu Bakr?
The answer is: what is meant is wishing for your brother to attain good in general terms, and to be protected from ills in general terms. The individual should love that for his brother as he loves it for himself. With regard to excelling in virtue and competing in achievements, there is nothing wrong with him preferring to surpass others in that regard. End quote.
Ibn Rajab (may Allah have mercy on him) said:  There are reports which indicate that there is no sin on the one who does not like anyone else to surpass him in beauty. It was narrated by Imam Ahmad (may Allah have mercy on him), and by al-Haakim in his Saheeh, that Ibn Mas‘ood (may Allah be pleased with him) said: I came to the Prophet (blessings and peace of Allah be upon him), and Maalik ibn Maraarah ar-Rahhaawi was with him. I caught up with him when he was saying: O Messenger of Allah, I have been given a share of beauty as you see, and I would not like anyone to surpass me even in the quality of his sandal straps or anything more than that. Isn’t that a transgression? He said: “No, that is not a transgression. Rather transgression is when a person rejects the truth and looks down on people.”
A similar report was narrated by Abu Dawood, from Abu Hurayrah (may Allah be pleased with him), from the Prophet (blessings and peace of Allah be upon him). In his report it mentions arrogance instead of transgression.
So the Prophet (blessings and peace of Allah be upon him) stated that not liking anyone to surpass one in beauty is not transgression or arrogance, and he explained arrogance and transgression as meaning rejecting the truth, which is being too arrogant to accept it, if it is contrary to one’s whims and desires.
End quote from Jaami‘ al-‘Ilm wa’l-Hukam (1/370).
Ibn Hajar al-Haytami said: What is meant by liking for your brother what you like for yourself here is general in meaning. It dictates that you should refrain from causing harm and trouble for people, and you should understand it as meaning that just as you love to be given your dues by others and seek justice for any wrong that is done to you, then if you owe anything to your brother or have done him any wrong, you should hasten to put the matter straight by giving him his dues and righting the wrong that you did to your brother. You should be fair even if you find it hard to do that.
In the hadith it says: “Think of what you like people to do for you, and do it for them.”
Hence when it was said to al-Ahnaf: From whom did you learn forbearance? He said: From myself. It was said to him: How was that?
He said: If I did not like something that someone else did to me, I would not do the same to anyone else.
This does not mean that a person should not like to be the best of people.
However, the more perfect way is something other than that. Al-Fudayl ibn ‘Iyaad said to Sufyaan ibn ‘Uyaynah: If you would like the people to be like you, then you have not sufficiently sincere, so how about if you like them to be below you?
End quote from al-Fath al-Mubeen bi Sharh al-Arba‘een, p. 307.
Conclusion: there is nothing wrong with you wanting to get the highest marks in the exams, and preferring this achievement for yourself, whilst still loving good and excellence for all your brothers.
If you attain perfection and love for them exactly what you love for yourself, then you will have preferred them over yourself, and this is a high level of selflessness and virtue, but it is not obligatory.
Ibn Battaal (may Allah have mercy on him) said in Sharh al-Bukhaari (1/65): Abu’z-Zinnaad said: The apparent meaning of the hadith is that you like your brother to be the same as you, but in fact what it means is that you like him to be better than you, because if a person loves for himself to be the best of people, and then he loves for his brother what he loves for himself, then in that case he will be among those who are surpassed. End quote.
And Allah knows best.