The outstanding physical properties of hexagonal boron nitride (h-BN) make it highly valuable for use in nanoelectromechanical systems. We investigate the nonlinear stochastic vibration of h-BN nanowire affected by piezoelectric. The nonlinear beam model considering the impact of piezoelectric effect excited by random force is established. Molecular dynamic simulations were utilized to determine the potential energy of h-BN nanowires under varying amplitudes affected by an external electric field. The findings suggest that an increase in the intensity of the electric field can result in buckling behavior, leading to the appearance of two stable points. The cases of pre-buckling and post-buckling of nonlinear dynamic behavior of h-BN nanowire induced by piezoelectric effect is discussed in this paper. Furthermore, the impact of the intensity of random force on the nonlinear stochastic vibration characteristics of h-BN nanowire is also examined.