Terahertz (THz) massive MIMO with wideband hybrid precoding has been considered one of the crucial techniques to compensate the high path loss in 6G high-data-rate Internet of Things (IoT). However, the beam split in wideband hybrid precoding makes the beam of different sub-carriers aim at different directions, which results in only partial channel state information (CSI) from the users to the base station. The efficiency of the CSI-based THz wideband beamforming scheme which is more efficient than the hardware-based scheme in the narrow band would degrade severely. To address the degradation, in this paper, we firstly propose a sensing-aided THz wideband hybrid precoding which restores the full CSI. Through sensing and deducing the angle-frequency information, we construct a channel selecting matrix and inverse the full CSI from our complete channel dictionary. Moreover, in order to satisfy the multi-user access requirements in IoT, we also propose dynamic RF chains and dynamic power allocation schemes to further enhance the performance in multi-user scenario based on a new precoding perspective in which each RF chains serves only one user. This benefits from the highly sparse THz channel characteristic. The spectral efficiency and energy efficiency are employed to validate that the proposed is efficient. The numerical results demonstrate that our proposed sensing-aided wideband hybrid precoding scheme achieves similar performance to the optimal precoding and much better performance to the true time delay scheme and the full CSI based scheme.