We investigate the effect of intra‐group competition and risk marginal per capita returns on subjects' cooperative behavior in a one‐shot public good game—following the well‐known approach proposed by Fischbacher, Gächter, and Fehr (2001) and extending the Colasante et al. (2018, 2019) parametrization. We study the interaction between environment and social preferences and test the existence of a causal relationship of risk and competition over cooperative behavior when an individual's benefit of the public good is heterogeneous and uncertain. Our results report experimental evidence about competition fostering cooperative behavior leading to a rise in contribution for all the subjects regardless of their social preferences. However, risk has a detrimental effect on cooperative behavior due to encouraging free riding.