Effective accident detection and traffic flow forecasting are of great importance for quick respond, impact elimination and intelligent control of the traffic flow consisting of autonomous vehicles. This paper proposes a traffic accident detection method for connected and automated transport systems by conducting a grid-based parameter extracting and SVC-based traffic state classification. Allowing for the dynamic spread of traffic flow over time, from upstream to downstream and from accident lanes to other lanes, a spatiotemporal Markov model is established to predict the evolution of traffic flow after accident by introducing the grid as state detection unit and fitting the spatiotemporal evolution with the parameter space mean speed to match the need of both detection accuracy and monitoring scope. Compared with actual accident data, the validation results indicate that the proposed methods present a good performance in accident detection with the accident detection rate as 87.72% and a higher precision rate than both SVM (support vector machine) and ANN (artificial neural network) models in traffic flow prediction. With the active traffic accident identification and dynamic traffic flow prediction, it is beneficial to shorten detection time, reduce possible impacts of traffic accidents and carbon emissions from congestion. The methods can be implied to traffic state recognition and traffic flow prediction, which is one of the significant sections of connected and automated transport systems, and serve as references for accident handling and urban traffic management.