You spend it after the roll.
The timing in that other question's answer is how it is because, there, you are making the roll with Advantage, and, it reasons, you can't properly roll with Advantage unless you roll the two dice simultaneously.
There is no similar need to roll simultaneously here, as this use of Luck doesn't involve Advantage and only superficially resembles that other question about using Inspiration. So, that precedent discarded as unrelated, that leaves us with just the text involved.
Rolling simultaneously with someone else requires coordinating with them, and is unusual enough in RPGs (and unheard of in D&D) that if you had to do that for some reason, it would be called out in the text. So we can discard simultaneity. (That doesn't rule out having to decide before the other attack roll is revealed, but I'll get to that in a minute.)
The trigger is "when an attack roll is made against you." This is after the roll has been made. If the decision had to be made before the roll was made, it would say so either by saying that you have to decide before you know the roll result, or by giving a trigger that happens earlier like "when you are attacked." It does neither, so the ability, and decision, is triggered after the die roll is made.
But maybe the decision is after the die roll, but before you know the result? This is possible, especially if your DM is making NPC/monster die rolls behind a screen. But, that's not the arrangement 5e assumes—it would not be taken as given, as the default, in how the rules are written. But even in the case of hidden rolls, the default would be that you decide after the roll is revealed—you can't react to a roll you don't even know is about your character! Since the trigger requires the attack roll be made against you, and it's not "when you are attacked", you don't need to decide when a rolling-in-secret DM merely says you're being attacked: you get to wait for the attack roll to be resolved, including what its result is—regardless of whether this result is the number rolled or just being informed that "it hits." Barring house rules around hidden DM dice rules, of course—this could be different at your table, so I want to stress that I'm only looking at what the rules appear to assume is the default, sans house rules.
This is an overly-complicated way to say: "You roll it after the attack, because the trigger is an attack roll having been made—past tense."
The answer really is that simple though and could have been written that simply. It's only longer because it takes effort to untangle it from that other question's unrelated issue first, and then once you're beating an idea with a language and logic analysis, the rest falls flat if it's not done with a similar degree of rigour. But that's the real answer, unencumbered by entanglements: you choose after, because the trigger says so.