Gordon John Angus McKay, from Buckhaven, appeared at Kirkcaldy Sheriff Court on Monday.
He made no plea or declaration and was remanded in custody. He will appear in court again next week.
Hayley, from Levenmouth, died at the Royal Hospital for Sick Children in Edinburgh on Wednesday, three days after being admitted.
A 36-year-old man has appeared in court charged with the murder of five-month-old Hayley Davidson in Fife last week.