We examine the effects of randomly introduced economic inequality on voluntary co- operation and whether this relationship is influenced by the quality of local institutions, as proxied by corruption. We use representative data from a large-scale lab-in-the-field public goods experiment with over 1,300 participants across rural Vietnam. Our results show that inequality adversely affects aggregate contributions, and this is on account of high endowment individuals contributing a significantly smaller share than those with low endowments. This negative effect of inequality on cooperation is exacerbated in high corruption environments. We find that corruption leads to more pessimistic beliefs about others' contributions in heterogeneous groups, and this is an important mechanism explaining our results. In doing so, we highlight the indirect costs of corruption that are understudied in the literature. These findings have implications for public policies aimed at resolving local collective action problems.