Prior studies on applications of Machine Learning (ML) algorithms to structural performance prediction problems have shown that they are competent for learning the mapping patterns within experimental data. Since most experimental data is acquired through reduced-scale specimens with simplified boundary conditions that are different from the actual structures, the extrapolation capability is critical for constructing a reliable performance prediction model of the structures. However, the existing ML-based data-driven approaches often fail to provide robust extrapolating predictions, and the efforts to enhance the extrapolation performance usually involve sophisticated model modification. A novel data-driven approach is devised herein addressing the issues through transforming the nominally regression-based prediction task into a classification task. Within this transformation procedure, relevant prior knowledge can be embedded to enhance the generalization capability of the predictive model. Two representative case studies on predicting the torsional capacities of reinforced concrete beams and the structural seismic response are carried out to examine the feasibility of the proposed approach. The influences of critical factors and settings of the proposed method are also investigated. The results indicate that extrapolation precision can be significantly improved in comparison with a conventional data-driven model, which would help to build a practical prediction model for engineering applications.