This paper presents the application of backtracking search algorithm (BSA) for solving the economic dispatch problem in a microgrid system. In this case, the economic dispatch (ED) problem in microgrids is modeled and is solved by BSA as the proposed method. BSA is an evolutionary method to solve optimization problems by utilizing crossover and mutation operators. A microgrid with several renewable and conventional generating units including wind power generators, fuel cell plants, and diesels has been used as the case study and the objective of the power dispatch is set to minimize the generation cost of local generators in the microgrid. The results BSA are compared with several methods confirming its high performance in optimizing the operation of microgrid. The results also validate the robustness of BSA as it produces the similar optimal in different trials. Sensitivity analysis is also done to tune the parameters of the optimizer to obtain the high quality results.