Good day,
Usually when a dentist does a clinical examination, we use a dental probe, which is sharp instrument, to check if the dark spot is sticky or hard.
Usually a hard black spot can be an area were bacteria has become inactive and doesn't necessarily need a filling, whereas a soft brown spot does.
Sometimes we do additional examinations such as taking relevant radiographs.
A stain can usually be removed by scaling or polishing the surface of the tooth.
It is best to let a dentist evaluate a stain/mark that you might suspect is a cavity and not a stain.