Design and preparation of capable anode materials is key to the development potassium-ion battery. In this study, N-doped biomorphic carbon is prepared from walnut septum by pyrolysis and then used as potassium-ion battery anode materials. The target carbon exhibits hierarchical porous structures with a specific surface area of 99.6 m2 g−1 and an interlayer spacing of 0.376 nm. When used as anode for potassium-ion battery, the N-doped hierarchical porous carbon exhibits high initial reversible capacity of 263.6 mAh g−1 at 0.1 A g−1 with an initial coulombic efficiency of 55.1%. At a high current density of 1 A g−1, it still shows ultralong cycling stability with a discharge capacity of 119.9 mAh g−1 after 1000 cycles. The excellent performance is attributed to the improved ions diffusion kinetics and electrons conductivity derived from hierarchical porous structures, large interlayer spacing, and nitrogen doping. Further calculation by cyclic voltammetry indicates that the mixed mechanisms of capacitance and ion-diffusion explain potassium-ion storage. At a low scan rate ion-diffusion behaviors provide an almost identical capacity with capacitance, and capacitive behaviors become dominant mechanisms with an increase in scan rate. The results would offer a new way to develop hard carbon anodes for potassium-ion battery.