Police say 23-year-old Tyreek Langs was selling heroin while holding his baby.
The incident happened in Central Islip, near Peters Boulevard and Kelly Avenue, around 3 p.m. Thursday.
Langs was arrested and charged with possession and sale of a controlled substance and endangering the welfare of a child.
The baby is now with her great grandmother.