before you get a chance to file, consider filing by mail. Attach documentation showing that you are the custodial parent with a note to the IRS. Custodial paperwork can be something from the school, lease agreement, church records,etc.
The IRS typically sides with the custodial parent unless the costodial parent has filed a IRS Form 8332 “Release/Revocation of Release of Claim to Exemption for Child by Custodial Parent”. If you are the custodial parent, you should formally sign the form 8332 for the years your ex will file.
If both parents are equally custodial parents, the IRS will typically select the parent with the highest income as the custodial parent.