We present a search for axionlike particles, a, produced in photon-proton collisions at a center-of-mass energy of approximately 4 GeV, focusing on the scenario where the a-gluon coupling is dominant. The search uses a -> gamma gamma and a -> pi(+)pi(-)pi(0) decays, and a data sample corresponding to an integrated luminosity of 168 pb -1 collected with the GlueX detector. The search for a -> gamma gamma decays is performed in the mass range of 180 < m(a) < 480 MeV, while the search for a -> pi(+)pi(-)pi(0) decays explores the 600 < m(a) < 720 MeV region. No evidence for a signal is found, and 90% confidence-level exclusion limits are placed on the a-gluon coupling strength. These constraints are the most stringent to date over much of the mass ranges considered.