Enhancing nuclear power plant (NPP) safety is demanded because of the recent beyond-design-basis earthquake near a NPP. Therefore, research on improving the seismic performance of the electrical cabinet, which ensures the safe operation of NPPs, is needed. In this paper, a tuned mass damper (TMD) is employed to control the seismic response of cabinet. To design the TMD, we employ existing design equations or perform numerical model–based optimization. However, limitations, such as inconsistencies with targeted control of the load and structure, the possibility of converging a local solution, and the high cost of numerical analysis. Therefore, this paper proposes a two-step machine learning and optimization method. Such an approach is utilized to find the optimal global design solution and reduce numerical analysis costs. Each step involves the design of experiment (DOE), response surface, and optimization. Notably, range setting in the DOE accounts for the difference between each step. In the first step, the sampling range is widened to determine the relationship between the design variables and the cabinet's response, and in the second step, the sampling range is narrowed depending on the result of the first step. Consequently, the proposed method reduced the cabinet's response by 35.4 % on average and numerical analysis cost declined by 1/3.