Due to the huge degree of freedom of structure, the optimal design of thermoelectric conversion performance of defective graphene nanoribbons is one of the difficulties in the field of materials research. In this paper, the thermoelectric properties of graphene nanoribbons with 5-7 ring defects were optimized using non-equilibrium Green's function combined with Bayesian algorithm.The results show that the Bayesian algorithm is effective and advantageous in the search of graphene nanoribbons with 5-7 ring defects with high thermoelectric conversion efficiency. It is found that the single configuration with the best thermoelectric conversion performance can be quickly and accurately searched from 32896 candidate structures by using Bayesian algorithm. Even in the least efficient round of optimization, only 1495 candidate structures (about 4.54% of all candidate structures) need to be calculated to find the best configuration.It was also found that the thermoelectric value <em>ZT</em> (about 1.13) of the optimal configuration of 5-7 ring defective graphene nanoribbons (21.162nm and 1.23nm in length and width, respectively) at room temperature was nearly one order of magnitude higher than that of the perfect graphene nanoribbons (about 0.14). This is mainly due to the fact that the 5-7 ring defects effectively inhibit the electron thermal conductivity of the system, which makes the maximum balance between the weakening effect of the power factor and the inhibiting effect of the thermal conductivity (positive effect). The results of this study provide a new feasible scheme for the design and fabrication of graphene nanoribbon thermoelectric devices with excellent thermoelectric conversion efficiency.