The accuracy of flood forecasting in small and medium-sized basins in arid and semi-arid regions needs to be improved, primarily due to a limited understanding of critical factors such as topographic features, critical rainfall, time of concentration, and recurrence intervals. In this paper, Xiahe County, Gansu Province, which is located in the semi-arid region, and Yongchang County, Gansu Province, which is located in the arid region, are selected as the research objects. Field investigations were carried out on flood-related factors across 34 small basins in 86 riverine villages of Xiahe County (2015) and 240 cross-sections in 395 riverine villages of Yongchang County (2014). Flood characteristics were assessed using the instantaneous unit hydrograph method, the regional empirical formula method, and the method proposed by the China Railway First Survey and Design Institute Group Co., Ltd. These methods were employed to calculate the time of concentration, design storms, and design floods for the study areas, and flood warning thresholds were estimated. Based on the calculation results, machine learning methods(linear regression, random forest and neural network) were used to establish a flood warning model for arid and semi-arid areas, and each model was evaluated and analyzed. The results show that there is a linear correlation between prepared transfer rainfall and factors such as rainfall during storms, warning rainfall threshold, and main channel slope, and the linear regression model can accurately calculate the warning rainfall. In order to further verify the applicability of the regression model, the model is used to invert and analyze the prepared transfer rainfall of 34 survey basins in Hezuo City, Gansu Province, the mean absolute error is only 0.56 mm.