China has encountered serious land loss problems along with urban expansion due to rapid urbanization. Without considering complicated spatiotemporal heterogeneity, previous studies could not extract urban transition rules at large scale well. This study proposed a random forest algorithm (RFA) based cellular automata (CA) model to simulate China's urban expansion and farmland loss in a fine scale from 2000 to 2030. The objectives of this study are to 1) mine urban conversion rules in different homogeneous economic development regions, and 2) simulate China's urban expansion process and farmland loss at high spatial resolution (30 meters). Firstly, we clustered several homogeneous economic development regions among China according to official statistical data. Secondly, we constructed a RFA-based CA model to mine complex urban conversion rules and carried out simulation of urban expansion and farmland loss at each homo-region. The proposed model was implemented on Tianhe-1 supercomputer located in Guangzhou, China. The accuracy evaluation demonstrates that the simulation result of proposed RFA-based CA model is more in agreement with actual land use change. This study proves that the primary factor of farmland loss in China is rapid urbanization from 2000, and the farmland loss rate is expected to slow down gradually and will stabilize from 2010 to 2030. It shows that China is able to preserve the 1.20 million km farmland without crossing the"red line"within the next 20 years, but the situation remains severe.