In this paper, an energy management strategy is developed in a renewable energy-based microgrid composed of a wind farm, a battery energy storage system, and an electolyzer unit. The main objective of energy management in the studied microgrid is to guarantee a stable supply of electrical energy to local consumers. In addition, it encompasses hydrogen gas production by using part of the available excess energy in the system, which has some economic benefits. Also, energy management can protect the battery bank from damage by preventing the possibility of it being overcharged. These objectives should be achieved by developing a robust and effective control technique for DC-DC converters that are connected to energy storage devices. For this purpose, an advanced control technique based on Model Predictive Control, which is recognized as a popular control technique for industrial and process applications, is developed. This technique has a fast dynamic response and good tracking features and is simple to implement. The simulation results prove the effectiveness of the proposed control strategy and control technique for energy management in the studied renewable energy-based microgrid.