An NYPD sergeant was sentenced yesterday to 12 months’ probation and a $500 fine for illegally accessing a terrorist watch list database on behalf of Canadian woman embroiled in a child-custody battle.

Prosecutors said Haytham Khalil, 34, agreed to dig up dirt on a man who was being monitored, and accessed the federal database to help the woman’s custody fight. Khalil pleaded guilty in January.

Officials said the eight-year veteran from Brooklyn tried to help his friend prove that her ex was on an FBI terrorist watch list by enlisting a fellow officer to use an NYPD computer to check the National Crime Information Center database.