#JavaScript (ES6), 78 bytes

Empty slots are `_`, mines are `7`.

<!-- language-all: lang-javascript -->

    f=(n,o=`___
    _${k=n}_
    ___`.replace(/_/g,c=>Math.random()<.5?--k|7:c))=>k?f(n):o

[Try it online!](https://tio.run/##FYtBDoIwEADvvGIPJrQpFC9GAxRe4A9MalMKKrhLCvGCvL3W08xh5mU@ZrH@Oa85UudC6BXDjNRda53owzYq3KNofZfezZOxjhW6GDKrmqtZH9Ib7OjNeC1PbZ6P33NpOVfN2PYMeUmhJ88QFBwrQKgVXCKF4LAlAJZwocnJiYbYCEjLG6aR/1Wk0XmV7OEH "JavaScript (Node.js) – Try It Online")