Question: I was wondering which gas would behave most ideally out of $\ce{H2},$ $\ce{He},$ $\ce{CO2}.$ All gasses are in the same condition.

I know the answer is either $\ce{H2}$ or $\ce{He}$ because of London dispersion forces. I was wondering which one it was and why.

Answer: 
In the simplest model, a gas is called ideal when its particles are point-like (no volume) and have no interactions. Real gases behave like ideal gases at low pressure (where the particle volume is neglible compared to the total volume) and high temperature (where condensed phases, i.e. interatomic or intermolecular interactions are disfavored).

The size-comparison between helium and dihydrogen is straightforward: Dihydrogen is larger. As for the strength of interparticle interactions, we can compare normal boiling points: Helium's is 4 Kelvin and dihydrogen's is 24 Kelvin.

So this would suggest that helium is "more ideal" as it has the lower boiling point and the smaller size.
I also agree with Karsten Theis that $\ce{He}$ would show more ideal behavior than that of $\ce{H2}$ for longer temperature range, just based on their boiling points. The boiling point of helium (~$\pu{4 K}$ or $\pu{-269 ^\circ C}$ at $\pu{1 atm}$) is more close to absolute zero temperature ($\pu{0 K}$) than that of $\ce{H2}$ (~$\pu{20 K}$ or $\pu{-253 ^\circ C}$ at $\pu{1 atm}$) where ideal gas have zero volume (theoretically; See Figure 1 below):

[![Relationship between volume and temp of real gas](https://i.stack.imgur.com/Vfj0V.jpg)](https://i.stack.imgur.com/Vfj0V.jpg)

In general, real gases behave like ideal gases at high temperatures and/or low pressures. However, at lower temperatures or high pressures, the interactions between the molecules and their volumes cannot be ignored (*e.g.*, van der Waals equation). For example, at lower temperatures (suppose at a constant pressure) close to its boiling point, the molecules get very close to each other, and hence, the interactions between molecules such as van der Waals forces start to act on each other. As a result, they tend to condense. This condensation causes a dramatic decrease in volume (see Figure 1 above). Thus, at first sight in comparison of real gas behavior between $\ce{H2}$ and $\ce{He}$, you can speculate that $\ce{He}$ has an extra temperature window ($\pu{16 K}$ more) to behave as a ideal gas than $\ce{H2}$ would.

In comparison to these two gases, $\ce{CO2}$ would not have a chance to have a better ideal gas behavior, based on its boiling point, ~$\pu{195 K}$ or $\pu{-78.5 ^\circ C}$ at standard pressure. 

I'd like to end my argument on one important note: According to the literature, both $\ce{CO2}$ and $\ce{H2}$ exhibit a triple point of each, but $\ce{He}$ doesn't. Don't you think it says something? I think $\ce{He}$ is the one most closed to an ideal gas than any other existing gases.