With stringent regulations of internal combustion engine on reducing CO2 emission, ammonia has been used as an alternative fuel. Investigating how engine-related performance is affected by partial ammonia replacement of diesel fuel is essential for understanding the combustion. Therefore, in this study, a three-dimensional numerical simulation model is developed for the burning of two fuels of diesel and ammonia based on relevant parameters (i.e., compression ratio, load, ammonia energy fraction, etc.) in a lab-made diesel engine. The consequences of load and compression proportion on combustion and pollutant emissions are investigated for ammonia energy fractions between 50% and 90%. When the ammonia portion rises, the increased ammonia equivalent ratio causes ammonia to move away from the dilute combustion boundary and accelerates the combustion rate of ammonia. An increase in compression ratio significantly increases the specified thermal performance and combustion efficacy. When the compression ratio is 16, as the ammonia energy fractions increases, due to the increase in the proportion of ammonia, that is, the proportion of nitrogen atoms increases, more NOx is generated during the combustion process. When the ammonia substitution rate is 90%, as the compression ratio increases, the cylinder pressure and temperature increase. The combustion efficiency of ammonia increases, generating more NOx and NOx emissions can reach 0.66 mg/m3. At a compression ratio of 18, the NOx emissions can reach 1.59 mg/m3. However, under medium and low load conditions, as the ammonia fraction increases, the total energy of fuel decreases, and the combustion efficiency of ammonia decreases, resulting in a decrease in the heat released during combustion and a decrease in NOx emissions. When the ammonia substitution rate is 90% and the load is 25%, NOx emissions reach 0.1 mg/m3. This research provides theoretical suggestions for the profitable and use ammonia fuel in internal combustion engines in a clean manner.