Nationals right fielder Bryce Harper said Friday he would participate in the Home Run Derby at his home ballpark as long as he makes the National League all-star team.

“So count me in for the Derby if and only if I make the team,” Harper said in a text message to The Washington Post on Friday afternoon. “But if I do I will be a participant in the 2018 HR Derby.”

As several of its most powerful sluggers – including former champions Giancarlo Stanton and Aaron Judge – said they would sit out the annual exhibition held the day before the All-Star Game, Major League Baseball had become desperate for Harper to participate because it needed some star power for the July 16 event at Nationals Park.

Harper, 25, had said previously he would participate should he make the NL roster, but he was noncommittal in an interview Thursday at Nationals Park. “I really haven’t decided,” he said then.

Since 2015, when he sat out the derby in Cincinnati, Harper had said he planned to participate in the 2018 event at Nationals Park. A recent slump, though, has dragged his numbers down, and that makes his participation in the All-Star Game not the sure thing it has been in the past three seasons. Harper does lead the NL with 19 home runs, however.

He currently sits second in voting among NL outfielders; the top three will be named starters.

Harper last participated in the Home Run Derby in 2013, when the event was held at the New York Mets’ Citi Field.

More baseball coverage from The Post: