Gallimard doesn't suspect that Song is a man. In court, he even testifies that he didn't know. Ultimately, it appears he doesn't want to believe that Song is a man, which would ruin the fantasy in which he is living.
Gallimard is so convinced that Song is a woman that he provides support for her supposed child that he believes he fathered. This is despite never seeing her nude. She claims that she's too modest to appear nude in front of him. When she returns with their child and Gallimard leaves his wife, they stay together for twenty years.
After the deception is revealed, Gallimard says, "I’m a man who loved a woman created by a man. Everything else simply falls short." He wants to live within the fantasy forever, and only Song revealing his real gender in court disrupts that fantasy. Even if Gallimard had suspicions, he would have repressed and ignored them to the point where it wouldn't have registered with him.