Which version? At one point, it was searching for "Dark Elf" for dark elf, with the space, which wasn't matching anything, and thus picking from any race. I changed it at some point to just strip all spaces from race, so it'd properly search for DarkElf. Latest version should fix. Can upgrade by extracting the mod over, then going back to mods screen and clicking "apply" (might need to turn off/on mod, but i don't think you need to).
Viewing post in Improved Random Portraits v1.0
Should be fixed in 0.3, but maybe you don't have it applied? After extracting a new version you have to go back in to mods and click apply, otherwise it'll keep using older code. Definitely don't see it with 0.4.
You do have to have some files with DarkElf in the path, if it can't find any DarkElf tagged portraits, it will choose any.