The whole episode of the Ark is one miracle after another. For example, it was beyond nature that everything could fit into a space that was obviously too small for everything that had to enter it. It should not be surprising that there was also a miracle that the air in the Ark was “filtered” and clear.
However, interestingly enough, some scientists suggest that the garbage generated in the Ark decomposed in a way that produced a variety of gases that were reintroduced into the Ark, which in effect created a whole ecosystem that kept the air pure and fresh.