To solve the problem that existing dehazing algorithms have difficulty in capturing paired hazy and clear images in the real world, while unpaired real-world hazy and clear images are readily obtained. In this study, unpaired real-world hazy and clear images are used to realize unsupervised dehazing. Inspired by the Generative Adversarial Network framework, the generator network combines multi-scale dense blocks and attention mechanism and uses adaptive blending operation to speed up network training while ensuring effective delivery of image details. By incorporating contrast learning, a weighted contrastive loss function is introduced, which encourages the recovered image to be close to positive samples and away from negative samples in the embedding space. Meanwhile, multiple loss functions are combined to enhance the generalization ability of the generative adversarial network in order to train the network more effectively. The proposed algorithm is tested on an outdoor public dataset, and the experimental results show that the algorithm has better performance than existing unsupervised dehazing algorithms.