Yes, races work just fine on treadmills - we can use your device's accelerometer to count your steps and estimate your pace and distance.
All you need to do is tap the Tracking button and choose 'Step Counting' rather than 'GPS'. On iPhone, this button will display "GPS" as default. When using step counting, we will be unable to show you a map of your run.
For the most accurate results, you should set your stride length.