According to the US-based National Renewable Energy Lab (NREL), solar energy losses due to faults were 3.5 % in 2004, which increased to 17.5 % in 2018. Therefore, the fault prediction mechanism will enable PV practitioners to reduce losses effectively, enhancing the solar system's efficiency and power output. This paper proposes a deep learning-based Transformer model for robust fault prediction in photovoltaic. Transformer uses attention mechanism that considers data points as a language units "word" and learn dependencies among them to predict upcoming data points. Unlike other forecasting algorithms, our proposed approach does not rely on previous trends. In case of PV faults, trends do not exist. The proposed algorithm utilizes rate of change of solar cell parameters for establishing a trend to forecast faults, enabling proactive fault mitigation. It also classifies faults with different severity levels to identify the level of predictive maintenance required. The proposed approach is extensively evaluated using MATLAB on datasets of several faults with low, medium, and high severity levels. The proposed Transformer model achieves a forecasting mean average error (MAE) of 0.09377. Performance of the proposed forecasting and classification algorithm is compared with existing machine learning-based regression and classification techniques such as KNN, SVM, and NN, where proposed approach outperforms state-of-the-art approaches.