The age to ride a dirt bike depends on the size of the dirt bike that you plan to ride.
You can begin riding gas powered dirt bikes as early as age 4 with training wheels but you need to be older to ride the larger size dirt bikes.
A 4 year old can begin riding a 50cc dirt bike with the training wheels to start learning how to ride the dirt bike.
But the larger and more powerful dirt bikes the kid should be between 6 to 13 years of age and then the bigger adult sized dirt bikes the person should be 17 to 18 and above to begin riding the dirt bike.
For me personally I would not want a 4 year old child riding a dirt bike because even with training wheels they can be dangerous.
But then again so our the cars we ride in but that's just me.