Most existing offline reinforcement learning (RL) algorithms face the challenges of distributional shift, which arises from uncertainty caused by limited samples and the inability to interact with the environment. To address this problem, we propose Uncertainty-Guided Adaptive Loss (UGAL) for Offline RL in order to effectively solve distributional shift problems by quantifying uncertainty. Our algorithm utilizes an ensemble of Q-networks to quantify sample uncertainty and leverages this uncertainty to adaptively adjust the loss function of the Q-value. Furthermore, we propose a novel adaptive Bellman operator for adaptive Q-value estimation and also analyze its contraction characterization. Meanwhile, our algorithm adaptively adjusts the weight of the behavior cloning (BC) loss based on the above Q-value function, thereby achieving a dynamic tradeoff between exploration and exploitation. By dynamically adjusting the hyperparameters of the model based on the uncertainty of dataset samples, the algorithm achieves better generalization, more accurate Q-value estimation and optimal policy learning. Experimental results on the D4RL benchmark tasks demonstrate that UGAL outperforms existing state-of-the-art methods on most tasks.