Transient stability assessment (TSA) is of great importance in power systems. For a given contingency, one of the most widely used transient stability indices is the critical clearing time (CCT), which is a function of the pre-fault power flow. TSA can be regarded as the fitting of this function with the prefault power flow as the input and the CCT as the output. In this paper, a data-driven TSA model is proposed to estimate the CCT. The model is based on Mahalanobis-kernel regression, which employs the Mahalanobis distance in the kernel regression method to formulate a better regressor. A distance metric learning approach is developed to determine the problem-specific distance for TSA, which describes the dissimilarity between two power flow scenarios. The proposed model is more accurate compared to other data-driven methods, and its accuracy can be further improved by supplementing more training samples. Moreover, the model provides the probability density function of the CCT, and different estimations of CCT at different conservativeness levels. Test results verify the validity and the merits of the method.