Aiming at the difficulty in detecting infrared dim small target under strong background clutter, we propose a novel algorithm of infrared dim small target detection based on Markov random fields(MRF) model. We at first use adaptive morphological filter to suppress the background clutter, then introduce new potential function and energy function according to MRF theory and infrared small target image features, and build a target detection model to confirm automatically the location and size of the target. Simulation results show that the algorithm is effective.