“in” can refer to a location as well as to membership in something:
I am in fifth-grade class. (I am enrolled in the group of students which is designated fifth-grade class.)
I am in fifth-grade class. (I am physically located inside the room labeled fifth-grade class)
“at” can indicate enrollment at a particular institution (the physical classroom):
I am at fifth-grade class. (I am physically located somewhere close enough to the room labeled fifth-grade class, and I am not necessarily inside it)
Compare it with “study-at-university-or-in-university”