Like Super said, the traction wheels are an easy fix and worth replacing if they’re old and worn.
There’s still a possibility that the gear on the drive axle is cracked and slipping. Also, several versions of James over the years have been very light in the nose and somewhat unbalanced. If there’s room, I would try adding weight in the front 1/3 of the engine. Two sources are the weights sold for model railroads and (possibility easier to find) those sold for Pinewood Derby racers.
There’s still a possibility that the gear on the drive axle is cracked and slipping. Also, several versions of James over the years have been very light in the nose and somewhat unbalanced. If there’s room, I would try adding weight in the front 1/3 of the engine. Two sources are the weights sold for model railroads and (possibility easier to find) those sold for Pinewood Derby racers.