Biofiltration with compost beds is a widespread biotechnological technique for removing odorous gases, such as hydrogen sulfide (H2S) and ammonia (NH3), produced in wastewater treatment plants. However, transient conditions, such as changes in the gas concentration and accumulation of subproducts, can affect the microbial community structure and function, therefore, the performance of biofilters. A better understanding of the relationship between operational conditions and microorganisms involved in the process is still necessary. In this work, two compost biofilters made from chicken manure and sugarcane bagasse for the treatment of H2S and NH3 were operated under variable gas inlet loads by decreasing the residence time (EBRT: 60, 45, 33, 25, 18s) at two gas concentration levels (52 mg H2S/m3 and 2 mg NH3/m3, and 260 mg H2S/m3 and 10 mg NH3/m3). Biofiltration performance was evaluated by considering the removal efficiency, oxidation products, and microbial community involved in the process. The maximum elimination capacity was reached at EBRT of 25s after a shutdown: 32.2±4.7 g H2S/m3h and 1.3±0.1 g NH3/m3h with a removal efficiency of 80% H2S and 91% for NH3. The shutdown period promoted the growth of sulfur-oxidizing bacteria and the oxidation of H2S to sulfate. The accumulation of ammonium in compost was the predominant removal mechanism of NH3. Additionally, the accumulation of sulfate and increasing gas load affected the composition of the microbial community in such a way that it led to the selection of a microbial population of halophilic or halotolerant bacteria, such as Halomonas, Truepera, Georgenia, and Paracoccus denitrificans, which could play an important role in the biofiltration of H2S and NH3. These results are useful for selecting a compost bed and applying operational strategies to achieve highly efficient biofiltration under industrial conditions.