Due to the wide use of AI (artificial intelligence) technology, machine learning has also obtained better development opportunities and has been more widely applied. At present, the library is in an important transformation stage. In order to adapt to new developments and changes, libraries must adapt to the trend of the times and make corresponding adjustments in functional forms, service methods, reading modes, as well as spatial design and construction management. How to ensure the smooth construction of the library through innovative spatial design methods and safe construction management, so as to provide users with more humanized and in line with the trend of the times for learning and communication, is an important issue in the current development of libraries. In order to better promote the spatial design and construction safety management of libraries, this article introduces machine learning and BIM technology. Through exploring and practicing the two, it is found that using machine learning and BIM (Building Information Modeling) technology in library spatial design and construction safety management is feasible. Compared to traditional library spatial design and construction implementation methods, this method can increase the lighting score in the library space function design by 15.5 and the material design score by 10.7. The score of furnishings design increased by 11.7, the score of decoration design increased by 13.3, and the score of infrastructure design increased by 12. At the same time, this method can also make the principles and requirements of library space design more in line with the current needs, and make the library space design more scientific and reasonable. In addition, the research on machine learning and BIM technology in this text can also enrich the application scope of AI and network physical systems, and broaden their application fields and methods.