Although developing a cultural identity is a core task for adolescents from immigrant families and the school is a highly important context in adolescence, to date, few studies have examined whether adolescents with particular cultural identities cluster in certain school contexts. Using data from a representative German sample including 7702 secondary school students of immigrant background from 1643 classrooms, we examined how the attended school track and four aspects of ethnic classroom composition relate to adolescents’ cultural identity (i.e., their ethnic identity and mainstream identity). Two‐level structural equation models indicated that students’ ethnic identity was not systematically associated with the attended school track and the ethnic composition of the classroom. However, attending the academic school track, a classroom with a low proportion of classmates with immigrant background and frequently using German with classmates related positively to mainstream identity. Ethnic diversity and proportion of co‐ethnics in class did not relate to mainstream identification. Our findings suggest that the ethnic identity of adolescents with an immigrant background in Germany is largely independent from the different socialisation contexts related to school tracks and the ethnic classroom composition. Yet, students’ with a strong mainstream identity cluster in certain school contexts.