Groundwater level (GWL) prediction is a critical issue in water resource management. With the development of deep learning (DL) models in recent years, many GWL prediction models built using influencing factors such as precipitation have achieved accurate predictions. However, data-scarce areas still face challenges in high-quality meteorological data collection. Given the hydraulic connectivity and spatial correlation of groundwater systems, this study proposes establishing prediction models based on GWL data from adjacent wells, and comparatively analyzes the impact of variations in input data spatial distance on GWL prediction. Utilizing LSTM as the foundational model, CNN-LSTM (CL) and CNN-LSTM-Attention (CLA) were built by integrating Convolutional Neural Network (CNN) and the attention mechanisms. The research findings illustrate that when using explanatory variables like precipitation as inputs to model, the average predictive NSEs of LSTM, CL, and CLA achieved 0.8918, 0.8849, and 0.8949, respectively. Meanwhile, in the scenario using GWL data from adjacent wells as inputs, the average predictive NSEs reduce to 0.7981, 0.8148, and 0.8426, respectively. Although models relying on adjacent wells data typically exhibit inferior performance, this validates the feasibility of the approach. The correlation analysis revealed a negative relationship between well distance and model performance. CLA stands out compared to other models because it can achieve effective predictions using data from adjacent wells within a range of at least 20 km. Moreover, the integration of CNN significantly enhances the model's ability to capture spatial features, and the attention mechanisms further contributes to improvement in the performance of GWL prediction models. This study provides new insights for GWL prediction in data-scarce regions and serves as a reference for the application of DL models in the field of groundwater.