Food safety is about everyone’s health. Through risk assessment and early warning of food safety, food-related safety issues can be identified as early as possible and take timely precautions. However, the detection data of food safety are complex and non-linear, so it is necessary to find the relationship and hierarchical representation of factors affecting food safety. This paper presents an improved entropy weight based on Hasse diagram technology (HDT) method to analyze the influencing factors of food safety. The entropy weight method was used to calculate the weight of each factor index, and the relationship matrix was obtained. Then, the data of infant milk powder in China were analyzed hierarchically by the HDT method. Thus, we can obtain the multi-level structure that affects food safety. It provides an effective basis for early warning of food safety, can help government regulators to strengthen management, and urge enterprises to produce food safely.