This study introduces a computational method to design a new aptamer with higher binding affinity to a special target in comparison with the experimentally available aptamers. The method is called step by step mutation based on MD simulation, which includes some steps. First, MD simulation is performed for the SELEX-introduced (native) aptamer in the presence of the target. Afterwards, conformational factor (Pi) is calculated for the simulated system, which obtains the affinity of the aptamer residues to the target. A nucleotide exchange is done for the residue with the least Pi parameter to the nucleotide with the highest Pi value that results in a mutant aptamer. MD simulation is performed for the target-mutant complex, and Pi values are calculated again. The nucleotide exchange is performed similarly, and the designing process is proceeded repeatedly that results in a mutant with the improved specificity to the target. The aptamer affinity to the target is also determined in each step through calculating the binding Gibbs energy (ΔGBind) as a reliable parameter. The introduced strategy is utilized efficiently to design a mutant aptamer with improved specificity toward sulfadimethoxine (SDM) antibiotic as a case study. The great difference in the ΔGBind values about 579.856 kJ mol-1 highlights that the M5 mutant possesses the improved specificity toward SDM in comparison with the native aptamer. Besides, the selectivity of the M5 aptamer toward SDM is examined among some conventional interfering compounds by using MD simulation that confirms the applicability of the designed aptamer for further experimental studies.