Well, if some of the pics are coming out fine as you say, it would seem that the lens is probably OK.
To test it, just take it out and point it at things and see if it focuses on them properly, you can see this in the viewfinder. Make sure you have selected a single AF point, so that you know what it should be focusing on.
If the lens seems to be OK, I would think about everything you are doing and see if you can find something that is causing this. It could be something very simple.
Some suggestions:
Are you using 'one-shot' focus, rather than AI servo, and part pressing the shutter and then following the car a bit before taking the shot? This will lock the focus at the longer distance, say the start of pit lane, so it will be out of focus when it passes in front of you.
Are you holding the lens by the focus ring and inadvertently adjusting focus manually slightly, without realising it?
In AI servo, the lens can briefly try and focus on something nearer (like a PA speaker on your side of the track) as you pan past it. This can then take a fraction of a second to get a lock back on the car, causing it to be out of focus if you shoot while it is still regaining focus. For example, I have sequences shot at airshows of planes doing a low flyby and can get two shots of a sharp plane, one of an oof head, one of an oof plane (as the AF recovers and heads back where it should be) then sharp plane again as the servo locks back on. If you are tracking the car in AI servo and have just passed a 'head' before you take your shot, that could cause this problem.
Hope you get this sorted out.