He has to present himself to a specialist, and if was diagnosed as female, and carries within him the organs of the female, he may transform if he have to do so. If he does not have female organs, and he is a real male, he is not allowed to do so, if the transform requires cutting off his masculinity organs and creating a female opening, and even if he does, and takes female hormones, he is not considered a female legally.
My advice to the owner of this case is to seek refuge in Allah, to take male hormones instead of female hormones, and to get treated for the psychological state by a specialist.