Is there a prayer which can protect me from bad people at school, and in general?.
Yes, there are many du’aa’s which if a Muslim recites them, they will be a means of protecting him from evil and evil people. These include the following:
1 – It was narrated that Ibn ‘Abbaas (may Allaah be pleased with him) said: The Prophet (peace and blessings of Allaah be upon him) used to seek protection for al-Hasan and al-Husayn and say: “Your father (i.e., Ibraaheem) used to seek protection by means of them (these words) for Ismaa’eel and Ishaaq: A’oodhu bi kalimaat-Allaah il-taammah min kulli shaytaanin wa haammah wa min kulli ‘aynin laammah (I seek refuge in the perfect words of Allaah from every devil and poisonous reptile, and from every envious evil eye).”
Narrated by al-Bukhaari, 3191.
2 – It was narrated from Abu Hurayrah that when the Prophet (peace and blessings of Allaah be upon him) was on a journey and got up or ended his journey in the last part of the night, he would say, “Sami’a saami’un bi hamdi Lillaah wa husni balaa’ihi ‘alayna. Rabbana saahibna wa afdil ‘alayna ‘aa’idhan Billaahi min al-naar (May a witness bear witness to our praise of Allaah for His favours and bounties upon us. Our Lord, protect us, show favour upon us and deliver us from every evil. I seek refuge in Allaah from the Fire).”
Narrated by Muslim, 2718
“Sami’a saami’un (literally, may a hearer hear us)” – al-Khattaabi said: This means, may a witness bear witness that we are praising Allaah for His blessings and favours.
3 – It was narrated that Khawlah bint Hakeem al-Sulamiyyah said: I heard the Messenger of Allaah (peace and blessings of Allaah be upon him) say: “Whoever makes a stop on a journey and says, ‘A’oodhu bi kalimaat Allaah il-tammaati min sharri ma khalaqa (I seek refuge in the perfect words of Allaah from the evil of that which He has created),’ nothing will harm him until he moves on from that place.”
Narrated by Muslim, 2708
4 – It was narrated from Moosa al-Ash’ari that when the Prophet (peace and blessings of Allaah be upon him) was afraid of some people he would say, “Allaahumma inna naj’aluka fi nuhoorihim wa na’oodhu bika min shuroorihim (O Allaah, we ask You to repel them and we seek refuge in You from their evil).”
Narrated by Abu Dawood, 1537; classed as saheeh by al-Albaani in Saheeh al-Jaami’, 4706
Shaykh ‘Abd al-‘Azeem Abaadi said:
What is meant is: We ask You to repel them, ward off their evil, deal with them and prevent any evil reaching us from them.
‘Awn al-Ma’bood, 4/277
And Allaah knows best.