Can the federal attorney propose to the court/judge that the defendant
should be imprisoned only for 2 years (for example), in case the jury
agree on a guilty verdict?
Yes. This is common.
Is the court/judge bound by this proposal or can the court/judge still
rule a higher sentence than the US federal attorney proposed?
The judge is not bound by the recommended sentence and can impose a higher sentence instead.
If the conviction arose from a guilty plea that was conditioned upon judicial acceptance of its terms, there are some circumstances when the guilty plea can be withdrawn and the case can go to trial if the judge takes this action, although that is the exception and not the rule. Usually, instead, a guilty plea with a prosecutor recommended sentence comes with the warning that the judge doesn't have to follow the prosecutor's recommendation, and when that happens, the guilty plea cannot be withdrawn even if the judge's sentence is much more severe than the prosecutor requested.
On appeal, a federal criminal sentence can be overturned if it unreasonably deviates from the federal sentencing guidelines in a manner that is an abuse of the judge's discretion. The charges brought by the prosecutor and the manner in which the prosecutor has presented the case, play a major role in determining which sentencing guidelines apply and are used to evaluate a federal criminal sentence on appeal. Failing to heed the recommendations of a prosecutor tends to favor an appeal's court determination that the judge abused his discretion in setting the sentence relative to the sentencing guidelines (particularly on factors like whether the defendant cooperated with the prosecution).
But, ultimately, this kind of appeal is hard to win even when the prosecutor's recommendation is disregarded, especially if the judge articulates in a written opinion or in an oral statement on the court record the reasons that the judge decided to deviate from the prosecutor's recommendations for legally recognizes grounds for doing so.
For what it is worth, in practice, it is highly unusual for a judge to impose a sentence more severe than the prosecutor has requested. But, it does happen.