How to set the amount of IMAP email stored locally in Apple Mail? My provider told me that our mail server is suffering because of a HUGE usage, and, to be more specific, IMAP usage.

I tracked down the issue to four Macs that use IMAP on quite big email accounts (more than 5GB each). 

My guess is that Apple Mail is storing locally a little amount of email, and send all search requests directly to the server. Can I set Apple Mail to have all the emails locally (so that searches are done only locally)?

Thanks,
(Assumptions: Clients are using Mail.app, clients are on a reasonably current version of the MacOS)

The point of IMAP is to store email on the server, so that the user can access their email from multiple devices and see the same list of messages. Also, this isn't a Mac specific thing, any email client using IMAP would be expected to maintain synced stores of email messages on both the client and the server, unless the user deliberately moves messages to a client-side only mailbox (which most clients allow).

As an aside, 5GB doesn't seem like a lot of email to me.

I would not configure Mail.app to send all emails to a client-side mailbox, but instead encourage users to create "On My Mac" mailboxes and store older email messages there.

To create an "On My Mac" mailbox in Mail.app, in the "Mailbox" menu choose "New Mailbox..." in the window that appears allowing you to name the mailbox, make sure that the "Location" pop-up is set to "On My Mac". The user would then have to manually move over the messages they wanted to store locally to the new mailbox. Note that this means you lose the ability to see the same list of messages from another client (like a phone) and moves 100% of the burden of backups to the client (but presumably you are backing up the client already).

To see how much space is being used by the various IMAP email boxes, right-click on the main inbox and select "Get Account Info". This should bring up a window showing all the IMAP mailboxes (Sent, Draft, etc.) and the space used by each.