We propose a new spectrum allocation strategy, aided by unsupervised learning, for multiuser terahertz communication systems. In this strategy, adaptive sub-band bandwidth is considered such that the spectrum of interest can be divided into sub-bands with unequal bandwidths. This strategy reduces the variation in molecular absorption loss among the users, leading to the improved data rate performance. We first formulate an optimization problem to determine the optimal sub-band bandwidth and transmit power, and then propose the unsupervised learning-based approach to obtaining the near-optimal solution to this problem. In the proposed approach, we first train a deep neural network (DNN) while utilizing a loss function that is inspired by the Lagrangian of the formulated problem. Then using the trained DNN, we approximate the near-optimal solutions. Numerical results demonstrate that comparing to existing approaches, our proposed unsupervised learning-based approach achieves a higher data rate, especially when the molecular absorption coefficient within the spectrum of interest varies in a highly non-linear manner.