could be mold or rot from too much rain/humidity or fruit fly or pepper weevil....I've had some flowers turning black before opening. some had larvae inside the flower, others were just rotten.
I would throw them out, it's usually a fungus. I had a ton of peppers do that this year, though I noticed certain varieties, such as Orange Habanero and Zavory, are much more prone to it than others. In fact, many of my culprits were C.Chinense, more than any other species. They definitely don't like a lot of water!
The seeds never develope and then they mold. It happens from the point the pods are formed I've had green pods that had black mold where seeds should be.