Lucky deals with the die roll, and so does Advantage/Disadvantage since it refers to the Lucky trait:
Lucky, PHB 28: When you roll a 1 on an attack roll, ability check, or saving throw, you can reroll the die and must use the new roll.
Advantage, PHB 173: if a halfling has advantage on an ability check and rolls a 1 and a 13, the halfling could use the Lucky trait to reroll the 1
Portent, on the other hand deals with the check as a whole:
You can replace any attack roll, saving throw, or ability check ... with one of these foretelling rolls.
And here comes the interesting part, the three emphasized terms are only mentioned in rules as actions, not numbers:
Attack roll, PHB 194: To make an attack roll, roll a d20 and add the appropriate modifiers. If the total of the roll plus modifiers equals or exceeds the target’s Armor Class (AC), the attack hits.
Saving throw, PHB 179: To make a saving throw, roll a d20 and add the appropriate ability modifier ... A saving throw can be modified by a situational bonus or penalty ...
proficiency in a saving throw lets a character add his or her proficiency bonus
Ability check, PHB 171: To make an ability check, roll a d20 and add the relevant ability modifier. As with other d20 rolls, apply bonuses and penalties, and compare the total to the DC.
All three go the standard way:
- Roll a d20, get a number
- In case of (dis-)advantage: roll another d20, get a new number (or keep the old)
- Add bonuses/penalties, get the final number
- Compare the final number with the AC/DC and get the final success/failure answer
From the strict RAW reading of Portent we have to replace steps 1–4 (the whole check) with a number (foretelling roll), which makes no sense, as the result has to be boolean – success/failure.
If we loosen the restrictions, the logical thing to say would be "In the context of Portent, attack roll/saving throw/ability check is the number to be compared with the AC/DC" (i.e. the result of Step 3 above). In this interpretation "You must choose to do so before the roll" means that the decision is made before Step 1 and therefore no actual die roll happens. The modifiers are applied to the foretold roll as normal (proof).
The portent die is intended to replace a d20 roll only, not any modifiers applied to it.
This result is RAI as well, the whole point is that the character knows in advance what is going to happen.