Accurate and reliable fault detection procedures are crucial for optimizing photovoltaic (PV) system performance. Establishing a trustworthy PV array model is the primary step and a vital tool for monitoring and diagnosing PV systems. This paper outlines a two-step approach for creating a reliable PV array model and implementing a fault detection procedure using Random Forest Classifiers (RFCs).Firstly, we extracted the five unknown parameters of the one-diode model (ODM) by combining the current–voltage translation method to predict the reference curve and employing the modified grey wolf optimization (MGWO) algorithm. In the second step, we simulated the PV array to obtain maximum power point (MPP) coordinates and construct operational databases through co-simulations in PSIM/MATLAB. We developed two RFCs: one for fault detection (a binary classifier) and another for fault diagnosis (a multiclass classifier).Our results confirmed the accuracy of the PV array modeling approach. We achieved a root mean square error (RMSE) value of 0.0122 for the ODM parameter extraction and RMSEs lower than 0.3 in dynamic PV array output current simulations under cloudy conditions. Regarding the fault detection procedure, our results demonstrate exceptional classification accuracy rates of 99.4% for both fault detection and diagnosis, surpassing other tested models like Support Vector Machines (SVM), K-Nearest Neighbors (KNN), Neural Networks (MLP Classifier), Decision Trees (DT), and Stochastic Gradient Descent (SGDC).