Public education is a sphere of society in which distributive justice with respect to the allocation of opportunities to learn can have profound and lasting effects on students' educational outcomes. We frame our study in the distributive justice literature, and define just outcomes specifically from a meritocratic and strict egalitarian perspectives in order to investigate how assignment to academic tracks and the availability of opportunities to learn during high school are associated with students' academic achievement during college. We examine the role of ''just'' placement into high school academic tracks, ''just'' access to high-quality teachers, and ''just'' assignment of secondary schools' resources in high school, in relation to college freshmen's grade point averages (GPA). We utilize longitudinal data from a unique dataset with over 15,000 students who spent their academic careers in North Carolina public secondary schools and then attended North Carolina public universities. Our results suggest that ''unjust'' assignment of students to certain high schools, access to high-quality teachers, and assignment to learn in specific academic tracks result in long-lasting consequences that are reflected in freshman college GPA. Importantly, findings also show that the direction and magnitude of the relationship between distributional injustice at schools and college performance is moderated by students' own gender and race. Race and gender interact with the high schools' institutional contexts operationalized by tracking practices, teacher quality, and by school racial and socioeconomic composition. Results show that similar settings do not affect all students in the same ways.