Previous studies have identified a great number of factors associated with corporate misconduct. However, ranking the importance of those related factors and using them to predict corporate misconduct in the construction industry have been overlooked. To address this gap, this study developed a random forest (RF) model to fulfill the variable importance ranking and corporate misconduct prediction. The RF model was built on the data of 953 observations from 93 Chinese construction companies in 2000–2018. Based on the variable importance analysis of RF, the top 11 important variables were obtained, of which all indicates corporate governance. They may be associated with an increased risk of corporate illegal activities. The developed RF model can be used to predict corporate misconduct to regulate decision making for construction companies and lead sustainable business development. This RF model could also facilitate regulators and investors to timely identify violating companies so that proactive interventions may be implemented in a targeted manner.