And just how do you know it’s 300 million years old??
Did it have a tag saying it was made in the year 300,002,021???
All you know is that you found a bone in the ground,
No More....
Correction*
The year 300,000,000
Well, first, it wasn't a bone, it was fossils, rocks, which right away suggests they're old, very old.
Second, most of the earth's geological strata have been mapped & studied to estimate their ages and conditions when first formed.
So once a geological stratum is identified, it's age can be estimated.
Third, there are dozens of different methods for determining ancient ages, including various radiometric processes.
When multiple methods produce similar results then confidence increases and any fossils found there can be used to help date those same fossils found elsewhere.
It's how science is supposed to work.