Background Early prediction of the outcomes of dementia is important and challenging. This study aimed to identify influential predictors from primary care electronic health records that can robustly predict whether patients with dementia will be admitted to hospital or remain under GP care. Methods Health records of patients with dementia were collected from general practice (GP) and hospital data in Wales between 1980 and 2015. These records were linked at individual patient level via the Secure Anonymised Information Linkage databank. The GP records of each patient were selected 1 year before diagnosis up to hospital admission. An artificial intelligence technique, neural network with entropy regularisation (a multilayer feedforward neural network whose weights between input layer and the first hidden layer were regularised by an entropy metric into the fitness function during training process) was used to automatically identify the most influential predictors from initial GP read codes, sex, and age. 10-fold cross validation was used to assess the predictive performance of the identified signals. Findings 52·5 million individual records of 59 298 patients (20 674 men, 38 624 women) with dementia were used. 30 178 were admitted to hospital and 29 120 remained with GP care. More men were admitted to hospital than stayed with GP care (11 233 vs 9441), whereas more women stayed with GP care than were admitted (19 679 vs 18 945). From the 54 649 initial event codes, the ten most important signals identified for admission for dementia were two diagnostic events (nightmares, essential hypertension), five medication events (betahistine dihydrochloride, ibuprofen gel, simvastatin, influenza vaccine, calcium carbonate and colecalciferol chewable tablets), and three procedural events (third party encounter, social group 3—skilled, blood glucose raised). They performed significantly above chance to predict admission to hospital with sensitivity of 0·758 (95% CI 0·731–0·785), specificity 0·759 (0·71–0·808), precision 0·766 (0·735–0·797), and negative predictive value 0·751 (0·741–0·761). Linear regression with all raw features yielded values of 0·286 (0·26–0·313), 0·804 (0·792–0·816), 0·487 (0·463–0·511), and 0·633 (0·615–0·651), respectively, and with ten identified features yielded values of 0·684 (0·679–0·691), 0·712 (0·705–0·718), 0·747 (0·738–0·754), and 0·644 (0·64–0·651). Interpretation Outperforming traditional methods, the artificial intelligence technique provides an effective means of identifying influential clinical signals to predict hospital admission of patients with dementia significantly above chance. Funding Health Data Research UK Wales and Northern Ireland Site, National Centre for Population Health and Wellbeing Research (CA02), Major Project of National Social Science Foundation of China (16ZDA0092), Guangxi University Digital ASEAN Cloud Big Data Security and Mining Technology Innovation Team.