The decision from U.S. District Judge Gregory Van Tatenhove was announced Tuesday during a hearing in Frankfort.
Farmer was also ordered to pay $120,500 in restitution.
Farmer was ordered to report to prison on March 18.
The Bureau of Prisons will determine where Farmer serves his time, but his defense asked the judge to request Farmer be jailed in his native Clay County.
Farmer admitted in September that he used public money and staff for personal items and errands, while he was Agriculture Commissioner.
He held the position for eight years.
Prosecutors said in memo Farmer deserved 27 months in prison, and a fine of more than $120,000.
Farmer played guard for the UK basketball team that became known as "The Unforgettables."