The no-wait flow shop scheduling problem (NWFSP) plays a crucial role in the allocation of resources in multitudinous industries, including the steel, pharmaceutical, chemical, plastic, electronic, and food processing industries. The NWFSP consists of n jobs that must be processed in m machines in series, and no job is allowed to wait between consecutive operations. This project deals with NWFSP with sequence-dependent setup times for minimizing earliness and tardiness. From the literature review of the last five years in NWFSP, it is noticeable that only around 1.92% of the researchers have studied that multi-objective function, which could help to improve the productivity of industries where methods such as just in time are considered. Besides, there is no information about previous researchers that have solved this problem with sequence-dependent setup times. Firstly, a MILP model is proposed to solve small instances, and secondly, a genetic algorithm (GA) is developed as a solution method for medium and large instances. Compared with the mathematical model for small instances, the GA obtained the optimal solution in 100% of the cases. For medium and large instances, the GA improves in an average of 31.54%, 38.09%, 44.58%, 47.72%, and 37.33% the MDD, EDDP, ATC, SPT, and LPT dispatching rules, respectively.