Neutrons can be generated in medical linear accelerators (Linac) due to the interaction of high-energy photons (> 10 MeV) with the components of the accelerator head. The generated photoneutrons may penetrate the treatment room if a suitable neutron shield is not used. This causes a biological risk to the patient and occupational workers. The use of appropriate materials in the barriers surrounding the bunker may be effective in preventing the transmission of neutrons from the treatment room to the outside. In addition, neutrons are present in the treatment room due to leakage in the Linac’s head. This study aims to reduce the transmission of neutrons from the treatment room by using graphene/hexagonal boron nitride (h-BN) metamaterial as a neutron shielding material. MCNPX code was used to model three layers of graphene/h-BN metamaterial around the target and other components of the linac, and to investigate its effect on the photon spectrum and photoneutrons. Results indicate that the first layer of a graphene/h-BN metamaterial shield around the target improves photon spectrum quality at low energies, whereas the second and third layers have no significant effect. Regarding neutrons, three layers of the metamaterial results in a 50% reduction in the number of neutrons in the air within the treatment room.