>>2874130well this was a neverending story after all... turns out that while ALPHA_THRESHOLD 0.997 got rid of the black spots, in a different pose white spots started appearing now... see screenshot
But I finally found the actual cause: the black spots are the images of the back of the sclera, which I had set to an Editor/ClearCoat material, and used the editor to give the sclera more brightness using EmissiveRGB.
Turning of the emissive properties, the black spots also disappeared. Looking into it, there seems to be a bug in the Ray-MMD emissive layer, that overwrites the customA property of materials in front of it. But customA is actually used for the rendering of materials with bump maps, so I think the shape of the spots is actually the shape of the sclera but scaled by the UV map.
Anyway, there's a fix here, which creates a separate emissive property instead of abusing customA, also fixing transparent materials in front of emissives:
https://www.deviantart.com/thesodawave/art/MMD-RAY-FIX-Emissive-through-transparent-DL-954156879