In recent years, coal mine has applied shield tunneling machines to roadway excavation to improve production efficiency. Geological condition is an important factor that determines the efficiency of shield machines. The shield machine is most favorable for medium to hard surrounding rocks such as limestone and sandstone. Therefore, the lithology prediction of the location of a planned excavation roadway becomes the core issue in improving the efficiency of the shield machine. At present, seismic inversion is an essential method for lithology prediction. However, in Yangquan Xinjing area, missing P-wave logging curves affects the impedance inversion. Therefore, using existing logging curves to generate missing P-wave logging curves and using sandstone exposure data to continuously update lithology distribution prediction results are of great interest. In this study, logging curves were first pretreated by standardization to ensure the inversion effect. Because of the missing acoustic logging curves, the random forest regression algorithm was introduced using density, natural gamma, apparent resistivity, and spontaneous potential curves as characteristic variables to establish a curve regression prediction model. Then, P-wave logging curves were acquired. After a full analysis of the principles of acoustic and gamma curves, a quasi-acoustic curve is constructed, and a quasi-acoustic inversion was performed. The top and bottom interfaces of the K7 sandstone were interpreted on the inversion data body. The interpreted horizon information was converted from the time domain to the depth domain. The predicted results agreed well with the exposed data. At the same time, combined with the lithology exposure data from the shield tunneling machine, the distribution prediction of the K7 sand body in the target roadway section was updated and iterated many times, which provided effective guidance for the optimization of the tunneling route of the shield tunneling machine.