We analyze the implications of communitarianism-the tendency of people to organize into separate culturally homogeneous groups-for individual and group inequality in human capital accumulation. We propose a non-cooperative social interactions model where each individual decides how much time to invest in human capital versus ethnic capital, and his utility from investment in either form of capital is increasing in the investment of his ethnic group in that form of capital. We find that, in equilibrium, the demand for human capital is affected positively by individual and group ability, and negatively by group size. Moreover, two groups that are ex ante identical in ability distribution may diverge in human capital accumulation, with divergence only occurring among their low-ability members. The latter always coordinate on the same type of investment, showing a contagion or herding effect. Furthermore, we find that ethnic and group fragmentation increases the demand for human capital. We validate these predictions of the model using household data from a setting where ethnicity and religion are the primary identity cleavages. We document persistent ethnic and religious inequality in educational attainment. Members of ethnic groups that historically converted to Christianity fare better than those whose ancestors converted to Islam. Consistent with theory, there is little difference between the high-ability members of these groups, but low-ability members of historically Muslim groups choose Koranic education as an alternative to formal education. Also, the descendants of ethnic groups that were evenly exposed to both religions outperform those whose ancestors had contact with only one religion, and local ethnic fragmentation increases the demand for formal education.