The god wants to punish the entire generation from Adam and Eve for the sin (or crime) purported to have been committed by them (earting forbidden fruit).
It is an accepted principle of criminal jurisprudence that only the person who committed the crime should be punished.