This paper presents a novel bilevel optimization procedure for enhancing the deblurring process using a weights variable nonlocal model. Theoretical analysis is conducted to study the solution of the model, and an efficient algorithm is developed to compute the clean image while learning the weights parameter and the nonlocal regularization term parameter are conducted. Through meticulous parameter selection, the proposed nonlocal deblurring model exhibits superior effectiveness and performance in comparison to other existing models.