Micro-pore structure has a decisive effect on the physical and mechanical properties of porous materials. To further improve the composition of rock-like materials, the internal relationship between microscopic characteristics (porosity, pore size distribution) and macroscopic mechanical properties of materials needs to be studied. This study selects portland cement, quartz sand, silica fume, and water-reducing agent as raw materials to simulate sandstone. Based on the Nuclear magnetic resonance (NMR) theory and fractal theory, the study explores the internal relationship between pore structure and mechanical properties of sandstone-like materials, building a compressive strength prediction model by adopting the proportion of macropores and the dimension of macropore pore size as dependent variables. Test results show that internal pores of the material are mainly macropores, and micropores account for the least. The aperture fractal dimension, the correlation coefficient of mesopores and macropores are quite different from those of micropores. Fractal characteristics of mesopores and macropores are obvious. The macropore pore volume ratio has a good linear correlation with fractal dimension and strength, and it has a higher correlation coefficient with pore volume ratio, pore fractal dimension and other variable factors. The compressive strength increases with the growth of pore size fractal dimension, but decreases with the growth of macropore pore volume ratio. The strength prediction model has a high correlation coefficient, credibility and prediction accuracy, and the predicted strength is basically close to the measured strength.