It’s not all about speed with Pokemon racing, HP lets you run longer, Attack helps you accelerate, defense helps you recover, Special attack helps you turn, Special Defense improves how well you jump.
Of course, it means nothing if the Pokemon isn’t big enough to ride.