Ahead geological prospecting, which can estimate adverse geology ahead of the tunnel face, is necessary in the process of tunnel construction. Due to its long detection range and good recognition effect on the interface, the seismic method is widely used in tunnel ahead prospecting. However, the observation space in tunnels is quite narrow compared to ground seismic prospecting, which leads to some problems in the acquisition of wave velocity, including: the velocity of the direct wave is used to replace the wave velocity of the forward rock approximately; the arrival time information of seismic waves is the main factor in time-travel inversion or the tomography method, which is sufficient to provide a simple model rather than deal with complex geological conditions. In view of the above problems, the frequency domain full waveform inversion method in ground prospecting is introduced to tunnel seismic prospecting. In addition, the optimized difference format is given according to the particularity of the tunnel environment. In this method, the kinematics and dynamics of the seismic wavefield are fully used to obtain more accurate wave velocity results. Simultaneously, forward modeling and inversion simulations on tunnel samples with typical adverse geological bodies are given here, which verified the validity and reliability of the proposed method.