Get your taxes done using TurboTax

The worst is that the IRS assesses back taxes, plus interest from the date originally due (April 15) and if they think he deliberately lied, they can also assess an accuracy penalty.  But it's all money. No jail or anything like that.

But he should not necessarily give up so easily.  If he claims the child and the ex files a complaint, I don't think the IRS will actually do anything.  If the ex files a tax return with a competing dependent claim, the IRS will investigate both parents, and they will be looking for custody evidence from both parents.  They aren't controlled by the court order.  While it may be hard for him to prove he physically had the child, it will be even harder for her to prove.

In my suggestions for evidence I should also have mentioned emails or texts about custody, drop offs and pick ups.  "Can you keep him an extra night so I can go clubbing."  "You didn;t show up to hand him over so I guess I'm keeping him another night." etc.

I wonder if the ex is trying to get "his whole refund" because she knows she won't qualify for much even with the child.

Most important is that he not pay her "his whole refund" to prevent her from filing a complaint.  Because even if he does pay her off, she could still file a complaint, and he is still at risk of losing the dependent investigation, and then would have to pay twice -- once to her and again to the IRS.  IF he actually wants to remove the dependent claim (and I don't think he should), but IF he wants to remove the dependent claim the ONLY thing he should do is file an amended return that removes the child and pay back the IRS, not her, and tell the ex to file her own return and get whatever she is actually entitled to that way.