While Obama would have badly lost if he were running for President from the State Senate, due to inexperience, an important caveat would be the following scenario:
Obama was originally elected to the U.S. Senate from Illinois in 2000 (I know IL didn't have a Senate election in 2000, but ignore that for my hypothetical scenario to be consistent with the actual). Then he runs against Bush Jr. in 2004. How would that election turn out?
Alan Keyes was a joke candidadte. Bush Jr. was not.
Bush Jr. was too, but just wasn't perceived as one.