God's judgment against wickedness is just because it aligns with His character as a holy and just God (Psalm 92:15). When faced with injustice, a just God casts judgment to restore righteousness. This judgment is not for the sake of punishment alone but is an invitation for reconciliation and correction, motivated by compassion rather than revenge.
The flood is an act of both divine justice and mercy. Justice is served by eliminating the violence, suffering and wickedness that had spread throughout the earth (Genesis 6:5; 6:13). God showed mercy by preserving righteous Noah and his family, as well as the animals, to repopulate the earth (Genesis 7:1; 9:1).
Besides the flood, the Bible provides many other examples where God's judgment is seen as a response to severe sin. God judged the people of Canaan with a command to wipe them out (Deuteronomy 20:16-18). He similarly judged Sodom and Gomorrah (Genesis 19:24-25), Nineveh (Nahum 1:14), and Tyre (Ezekiel 26:4). And the final judgment before the Great White Throne will result in all the wicked from all time being cast into the lake of fire (Revelation 20:11-15). The plain message of the Bible is that God does judge sin, whether by an invading army, by fire and brimstone, or by a catastrophic global flood. Even when God's judgment seems harsh, it reflects His commitment to justice and His desire to protect and redeem His people.
Even with a new beginning after the flood, humankind still needed God's intervening hand of salvation. Paul explained to the Romans, "for all have sinned and fall short of the glory of God, and are justified by his grace as a gift, through the redemption that is in Christ Jesus, whom God put forward as a propitiation by his blood, to be received by faith" (Romans 3:23–25). Jesus' sacrifice on the cross paid the penalty for sin; His resurrection confirmed it. When we receive Jesus' work on our behalf by faith, we are made right before God, and it results in our sanctification and eternal life (Romans 6:22).