This is horrible and I can totally see how it was racist (and I am white, fwiw). Although I hope I'm not that prejudiced, I think there are very different stereotypes around white people who dabble with weed (middle-class, creative, hippyish, musicians, nice old ladies with arthritis) and black people who dabble with weed (rastas, yardies, dealers, knives, gangs). I can well believe that played a part in the decision to search the girl in such a humiliating way.
I also wonder if there was an element of resentment on somebody's part, that despite not only being black but black with dreadlocks, and possibly smoking or being around weed, this girl was doing so well at school. A desire to take her down a peg or two. If she was literally top of the class, maybe a racist teacher or teachers who consciously or unconsciously wanted a white pupil to have that honour.
Whatever else happens, I hope she is eventually able to overcome this awful trauma and have the successful life she deserves.