This work aims to improve the accuracy of the waiting times prediction in ED, by incorporating queue variables enabled by process mining that capture the crowding of the activities inside the ED. By undertaking process mining, it is possible to gain insights into the hospital processes extracting the entire patient-flow and the queueing-related information (e.g., activity occurrence, sojourn timestamp, etc.). Enriching the set of possible predictors with queue-based variables may result in better prediction models. We determined a set of candidate predictor variables from the data, according to literature review and process analysis. Alongside the traditional features that influence waiting time in ED (patient, temporal and staff-based variables), we developed a new queue-based predictor that measure the queue for each ED activity, exploiting the event log and the patient-flows. Then, we implemented and tested three data mining techniques according to this set of predictors, to forecast the waiting time in ED. In this work, we used real data from an Italian Emergency Department. We innovatively derive the queue-based predictors, exploiting the process mining approach. Specifically, we started discovering the process model from the event log using process mining tools. The discovered process map allowed to obtain in-depth information about the structure of the process, the main patient-flows, the frequency and duration of activities. Exploiting such information, we were able to measure the queue of patients in front of each activity inside the process at any point in time. The paper can provide some practical indications both for patients and hospital managers. Providing patients with accurate waiting time information positively affect their behaviour by increasing their tolerance for waiting. This leads to increased patient satisfaction and reduces the number of patients who decide to leave the ED without being seen by a physician. From a hospital point of view, predicting the waiting time allows hospital manager to be constantly informed regarding the volume of patients in the ED and, thus, supports them in prioritizing patients and managing efficiently the resources.