Optomechanical crystal (OMC) cavities which exploit the simultaneous photonic and phononic bandgaps in periodic nanostructures have been utilized to colocalize, couple, and transduce optical and mechanical resonances for nonlinear interactions and precision measurements. The development of near-infrared OMC cavities has difficulty in maintaining a high optomechanical coupling rate when scaling to smaller mechanical modal mass because of the reduction of the spatial overlap between the optical and mechanical modes. Here, we explore OMC nanobeam cavities in gallium nitride operating at the ultraviolet wavelengths to overcome this problem. With a novel optimization strategy, we have successfully designed an OMC cavity, with a size of 3.83 × 0.17 × 0.13 μm3 and the mechanical modal mass of 22.83 fg, which possesses an optical mode resonating at the wavelength of 393.03 nm and the fundamental mechanical mode vibrating at 14.97 GHz. The radiation-limited optical Q factor, mechanical Q factor, and optomechanical coupling rate are 2.26 × 107, 1.30 × 104, and 1.26 MHz, respectively. Our design and optimization approach can also serve as the general guidelines for future development of OMC cavities with improved device performance.