I have read it is makrooh to marry an infertile woman. Is it okay for a guy to marry an infertile girl knowing she is infertile or is it better to marry a fertile girl? Is there any consequences for doing this if it is makrooh
No problem in marrying infertile people.
Marrying fertile women is a recommendation, not a rule. A barren woman can be a second or third wife.
If the possibility of her conceiving is there and she is a righteous woman go ahead with it.
The prophet salla allahu alaihi wa sallam recommended men who have no children to marry someone who is not known to be barren.