As a typical family of two-dimensional (2D) materials, MXenes present physiochemical properties and potential for use in energy storage applications. However, MXenes suffer some of the inherent disadvantages of 2D materials, such as severe restacking during processing and service and low capacity of energy storage. Herein, a MXene@N-doped carbonaceous nanofiber structure is designed as the anode for high-performance sodium- and potassium-ion batteries through an in situ bioadsorption strategy; that is, Ti3C2Tx nanosheets are assembled onto Aspergillus niger biofungal nanoribbons and converted into a 2D/1D heterostructure. This microorganism-derived 2D MXene-1D N-doped carbonaceous nanofiber structure with fully opened pores and transport channels delivers high reversible capacity and long-term stability to store both Na+ (349.2 mAh g-1 at 0.1A g-1 for 1000 cycles) and K+ (201.5 mAh g-1 at 1.0 A g-1 for 1000 cycles). Ion-diffusion kinetics analysis and density functional theory calculations reveal that this porous hybrid structure promotes the conduction and transport of Na and K ions and fully utilizes the inherent advantages of the 2D material. Therefore, this work expands the potential of MXene materials and provides a good strategy to address the challenges of 2D energy storage materials.