I did a fMRI study as a volunteer in college.
It involved going to the lab and practicing the thing (a puzzle / maze) I would be shown during the actual MRI. I think I went in to “practice” a couple times before showing up and doing it in the machine.
IIRC the purpose of practicing was exactly that, to avoid me trying ti learn something during the scan (since that wasn’t the intention of the study).
In other words, I think you can control for that variable.
(Side note: I absolutely fell asleep during half the scan. Oops! I felt bad, but I guess that’s a risk when you recruit sleep deprived college kids!)