Barring any sort of glaring injury like a burn, how easy is it for a dermatologist to tell if someone has scarring alopecia and their hair follicles have been permanently damaged?
I’m a female in my twenties and have had scalp dermatitis for several years. I tend to scratch it pretty badly in my sleep, resulting in small open spots that then scab over. Just within the last five months or so, I have developed bald patches as well as diffuse hair loss. There are other things it could be, but is scarring alopecia a possibility? Also, could the hair loss be from the dermatitis itself?

The best way to determine which alopecia condition you have, is to get a dermatologist with considerable experience in diagnosing the various alopecias to give you an opinion. You may then need to get a biopsy of the area of alopecia and get a dermatopathologist to read the biopsy if there is any doubt on cause. Most good dermatologists do this in tandem, although your history seems to suggest that your constant scratching has produced traction alopecia with possibly some scarring. Sometimes, the alopecia will reverse (Alopecia Areata for example) if you completely stop scratching it.
Clearly, the picking of your hair at night can produce trichotelomania, which is a condition where constant picking or scratching causes hair loss. The diagnosis is always clear on microscopic examination of the scalp. If it only happens in your sleep, put on mittens and sleep with them on. Get a good doctor to examine you before you startsleeping with the mittens and after a few months. If the mittens works, then the changes that we can see under magnification will demonstrate that you are on the right path. Ordinary dermatitis without picking or scratching should not cause hair loss, unless is is associated with the genetic forms of hair loss.