Optical logic devices are essential functional devices for achieving optical signal processing. In this study, we design an ultra-compact (4.92 × 2.52 μm2) reconfigurable optical logic gate by using inverse design method with DBS algorithm based on Sb2Se3-SOI integrated platform. By selecting different amorphous/crystalline distributions of Sb2Se3 via programmable electrical triggers, the designed structure can switch between OR, XOR, NOT or AND logic gate. This structure works well for all four logic functions in the wavelength range of 1540–1560 nm. Especially at the wavelength of 1550 nm, the Contrast Ratios for XOR, NOT and AND logic gate are 13.77 dB, 11.69 dB and 3.01 dB, respectively, indicating good logical judgment ability of the device. Our design is robust to a certain range of fabrication imperfections. Even if performance weakens due to deviations, improvements can be obtained by rearranging the configurations of Sb2Se3 without reproducing the whole device.