We theoretically and numerically demonstrate optimal design of wavelength selective thermal emitter using one-dimensional (1D) and two-dimensional (2D) metal-dielectric gratings for thermophotovoltaic (TPV) applications. Proposed design consists of tungsten (W) and silicon dioxide (SiO2) gratings which can withstand high temperatures. Radiative properties of 1D grating were calculated using a numerical method, while effective medium approximation was used for 2D gratings. Optimal designs were obtained such that output power is maximum for GaSb photovoltaic (PV) cell at emitter temperature of 1500 K and radiated energy for longer wavelengths is limited to a low value. A constrained optimization was performed using genetic algorithm (GA) to arrive at optimal design.