Noah was "right with God" (righteous) BEFORE the ark was even discussed. It even says "Noah walked with God" much like Enoch. I liken Noah to Abraham. Abraham simply believed God and it was credited to him as righteousness (Rom 4:3) but he was also justified by his works but much later (James 2:21).