In any EAS array, the rejection of events with shower cores outside the detector boundaries is of great importance. A large difference between the true and the reconstructed shower core positions may lead to a systematic miscalculation of some shower characteristics. Moreover, an accurate determination of the shower core position for selected internal events is important to reconstruct the primary direction using conical fits to the shower front, improving the detector angular resolution, or to performe an efficient gamma/hadron discrimination. In this paper we present a procedure able to identify and reject showers with cores outside the ARGO-YBJ carpet boundaries. A comparison of the results for gamma and proton induced showers is reported.