This page of the Baldur's Gate 3 guide has a walkthrough for a Rescue the gnome quest. This solution will help you to complete the task.
- Get close to the goblins;
- stop the windmill.
You activate this quest while visiting an abandoned village. There, you find a windmill (M5;6) and a group of goblins who bully Barcus. As soon as you get close to them, the conversation starts. If you can pass the persuasion skillcheck or use Illithid's power, you can drive the group away. Otherwise, you'll have to fight.
When you deal with the enemies, enter the windmill. You'll find a brake lever there. Pull it, and the machine will stop.
Now you can approach the strapped gnome. If you decide to free him, you'll have to chat with him and find out how he got there. Once the talk is over, the quest will be completed.