Realizing the significance of precise detection of hemoglobin concentrations towards early diagnosis of several diseases, the present work addresses design and analysis of hemoglobin sensor based on the defective 1D photonic crystal (PhC). The alternating layers of Si and SiO2 are used to design the proposed PhC with a central defect layer infiltrated with hemoglobin concentrations. The well-established transfer matrix method (TMM) is manipulated to study the transmission spectrum of the structure. The strong dependence of defect mode characteristics on the refractive index of the hemoglobin concentrations forms the backbone of this work. Numerous geometrical parameters such as thickness of defect layer, angle of incidence are meticulously optimized to realize high sensitivity. Additionally, the effect of temperature is thoroughly investigated on the sensing performance. It is perceived that at an incident angle of 300 and the defect layer thickness of 550 nm, the proposed structure bestows a maximum sensitivity of 1916.77 nm/RIU. Finally, we developed a machine learning model to predict different concentrations of hemoglobin in blood, where we found that the model output is closely matched with the output obtained through the TMM. Moreover, it is perceived that the developed machine learning model can predict hemoglobin concentrations with high accuracy and linearity.