The British number two took the opening set against three-time champion Djokovic, who is unbeaten in 2020.
But the Serbian found his form to stretch his winning streak to 25 matches with a 6-7 (5) 6-3 6-4 6-2 victory.
World number 44 Edmund came into the match with a win over Djokovic under his belt, on clay in Madrid in 2018. He had also taken the first set when they met at Wimbledon later that year.
However, just as he did at SW19, Djokovic took the next three and made it six wins over the Briton to move a step closer to grand slam title number 18.
With Andy Murray among the players watching on from the empty stands in Arthur Ashe Stadium, Edmund went toe-to-toe with his illustrious opponent in the first set.
The 25-year-old saved three break points in the third game before finding his service rhythm impressively.
In the tie-break, Edmund fashioned the first set point on his own serve and took it in style with an ace right down the T.
However, Edmund came up with two double faults to hand Djokovic the first break of the match early in the second, and he drew level by crunching down an ace.
A double break in the third set put an increasingly pumped up Djokovic firmly in control and Edmund’s New York campaign was ended in three hours and 13 minutes.
Djokovic said: “I just had to hang in there, mentally. Kyle played a fantastic first set, he didn’t do much wrong, he served very well and was aggressive from the back of the court.
“For a set-and-a-half it was anybody’s game. But after the second set I felt more comfortable. It was a very good test and I’m happy to get through.”
Edmund took plenty of positives from an encouraging display.
He said: “It was a good test for me. He was coming in in more form than I was. But I thought overall it was a really good test to see where I’m at.
“I thought my level was good. There were stages where my level dropped then I picked it up a bit, and broke him in the third. But he’s number one in the world for a reason.”