Riding the dirt bike on terrain or tracks requires no license or laws. But it doesn't mean you ride it on the streets.
In the USA, except for some states, almost all states allow dirt bike riding more easily if you are not underage.
The most important factors for riding a dirt bike in different states of the USA can be different, but mostly all states want riders to follow safety rules.
In most Us states' OHV riding zones, you must buy an annual pass/sticker or a daily admittance fee. Most racing contests require AMA membership (AMA).
You'll need a street bike license if you plan to ride a dual-sport motorcycle on roads between trailheads.
You should take a skill or safety course even if your state doesn't mandate it. Dirt bikes aren't street legal and can't link trails.