Stuck pipe remains as one of the major risks in the drilling operation that could cause significant non-productive time (NPT). The earlier stuck pipe risk is predicted and mitigated, the higher the chance of preventing its occurrence in the first place. In this study, a new model was proposed using random forest (RF) algorithm together with sliding window technique to quickly detect the symptoms of potential stuck pipe, by capturing the hidden pattern and trends of certain real-time drilling parameters (hook load, Torque, standpipe pressure and weight on bit) fall outside of the boundaries calculated dynamically from the Pauta Criterion. After being trialed on wells for both offshore and unconventional, the developed model is able to give the early indication of an impending stuck pipe from 3 minutes to 43 minutes ahead of its actual occurrence, thus leave the rig crew valuable time window to take proper interventions.