Evidence from terrestrial ecosystems indicates that biodiversity relates to ecosystem functions (BEF), but this relationship varies in its strength, in part, as a function of habitat connectivity and fragmentation. In primary producers, common proxies of ecosystem function include productivity and resource use efficiency. In aquatic primary producers, macroecological studies have observed BEF variance, where ecosystems with lower richness show stronger BEF relationships. However, aquatic ecosystems are less affected by habitat fragmentation than terrestrial systems and the mechanism underlying this BEF variance has been largely overlooked. Here, we provide a mechanistic explanation of BEF variance using a trait-based, numerical model parameterized for phytoplankton. Resource supply in our model fluctuates recurrently, similar to many coastal systems. Our findings show that following an extinction event, the BEF relationship can be driven by the species that are the most efficient resource users. Specifically, in species-rich assemblages, increased redundancy of efficient resource users minimizes the risk of losing function following an extinction event. On the other hand, in species-poor assemblages, low redundancy of efficient resource users increases the risk of losing ecosystem function following extinctions. Furthermore, we corroborate our findings with what has been observed from large-scale field studies on phytoplankton.