Competition is good to a certain extent and it can teach many life lessons. Although at the beginning emphasis should be on fun and participation, with time they will be ready to take up competition and focus on a regular training schedule.
This is best to start around 10 to 12 years. You as parents should guide them on expectations and be supportive. Children should be taught that losing a race should not reduce their self- worth.
Focus more on fun and participation than competition if they are younger than 10 years. Setting up goals and training to achieve them are important life lessons.
As your child runs more races, they will improve more and focusing on competition can be gradual.