A 23-year-old homeless man was arrested Thursday for fatally stabbing the mother of his children inside a Bronx shelter, cops said.

Ernesto Valerio was charged with murder and criminal possession of a weapon in the Wednesday afternoon attack inside the Help Morris shelter at 285 E. 171st St., according to police.

The homeless woman, 19-year-old Enilies Calix, died in the shelter, cops said.

The two had small children together, but it was not clear who is caring for the kids, police said. One as young as 18 months, sources said.

The kids were “safe” and handed over to the city’s Administration for Children’s Services, according to a spokeswoman for the agency.