In Spanish magic books of some decades ago, The Discoverie of Withcraft was mentioned as the first book containing explanation of magic tricks. It was published in 1584. However, French magicians point out that a French book, "La Première partie des subtiles et plaisantes inventions" by Jean Prevost, also published in 1584 might predate The Discoverie by a few months. The French book is devoted completely to magic tricks whereas The Discoverie of Withcraft was written in defense of people --mainly poor old women-- accused of witchcraft. Reginald Scot, the author, was a skeptic and included in his book a lot of material (not just magic tricks) to prove that witchcraft doesn't exist.
By the way, both books can be downloaded for free:
The Discoverie of Witchcraft: https://www.gutenberg.org/files/60766/60766-h/60766-h.htm
La Premiere partie des subtiles et plaisantes inventions: https://gallica.bnf.fr/ark:/12148/btv1b73003635/f21.item
Scot's book, The Discoverie of Witchcraft, was published during the reign of Queen Elizabeth I but her successor, King James VI (of King James' Bible fame), being a believer in witchcraft (he even wrote a book against it: Daemonology (1597), banned Scot's Discoverie of Witchcraft and even held public burnings of copies of it. James VI went as far as to personally supervise the torture of women accused of being witches.
Those two books might be the first two PRINTED magic books. However there exists a book that was not printed that is really the first book of magic tricks: De Veribus Quantitatis, written by Luca Pacioli (1447-1517), a Catholic monk of the Dominican Order. He was a friend of Leonardo da Vinci and they collaborated in, at least, one important work. It's thought that Pacioli taught mathematics to Leonardo. Since Fra. Luca Pacioli died 67 years before the publication of any of the two books mentioned above, his book might well be the first containing magic tricks, at least until they discover an older one.
Pacioli's manuscript lay dormant for centuries in the University of Bologna until finally published a few years ago.
There's a very interesting article on The Conjuring Arts Research Center website:
Also here: https://www.abocashop.com/en/de-viribus-quantitatis-facsimile-for-professional-use
If you want to see the original manuscript, then follow the link below (in Italian):