Buildings, as key factors influencing population distribution, have various functional attributes. Existing research mainly focuses on the relationship between land functions and population distribution at the macro scale, while neglecting the finer-grained, micro-scale impact of building functionality on population distribution. To address this issue, this study integrates multi-source geospatial and spatio-temporal big data and employs the XGBoost algorithm to classify buildings into five functional categories: residential, commercial, industrial, public service, and landscape. The proposed model innovatively incorporates texture, geometric, and temporal features of building images, as well as socio-economic characteristics extracted using the distance decay algorithm. The results yield the following conclusions: (1) The proposed method achieves an overall classification accuracy of 0.77, which is 0.12 higher than that of the random forest-based approach. (2) The introduction of time features and the distance decay method further improved the model performance, increasing the accuracy by 0.04 and 0.03, respectively. (3) The correlation between the building functions and population distribution varies significantly across different scales. At the district and county levels, residential, commercial, and industrial buildings show a strong correlation with population distribution, whereas this correlation is relatively weak at the street scale. This study advances the understanding of building functions and their role in shaping population distribution, providing a robust framework for urban planning and population modeling.