EXHIBIT 23.1

CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM

We consent to the incorporation by reference in the Registration Statement (No. 333-234505) on Form S-8 of Mayville Engineering Company, Inc. of our report dated June 20, 2025, with respect to the statements of net assets available for benefits of the Mayville Engineering Company, Inc. 401(k) Plan as of December 31, 2024 and 2023, the related statement of changes in net assets available for benefits for the year ended December 31, 2024, and the related supplemental schedule as of December 31, 2024, which report appears in the December 31, 2024 annual report on Form 11-K of the Mayville Engineering Company, Inc. 401(k) Plan.

/s/ Wipfli LLP

Minneapolis, Minnesota

June 20, 2025