The optimal dispatch for hybrid microgrids is the crucial approach to decrease maintenance costs and enhance operational reliability. This paper aims to provide a feasible solution for the optimal dispatch of a solar thermal-photovoltaic hybrid microgrid. A distributed energy system of a building is established and the power load is analyzed. Operation parameters are optimized for hybrid microgrid in isolated operation mode and grid-connected operation mode. The operation performance with adequate and inadequate solar irradiation is evaluated by using fixed dispatch and optimal dispatch strategy. In addition, the performance of hybrid microgrid under power selling and purchasing conditions are analyzed. Results show that the operation mode of building hybrid microgrid can be adjusted to isolated/grid-connection modes based on actual power requirements. The optimal dispatch strategy shows great advantages on both solar adequate and inadequate conditions under isolated operation mode for hybrid microgrid, at most 14.3 % lower for maintenance than that of fixed strategy. In addition, the power selling to the external power grid can significantly improve the profit of the hybrid microgrid and generate earnings of $6102.1 per year under optimal dispatch. The research can offer an analysis approach for hybrid microgrid, and further increase clean energy utilization efficiency.