I don't find any API to get datasetId using reportId.
The thing I've noticed is that a dataset name are the same as a report name, so it might be one approach to get datasetId using reportName.
You can retrive the reports' names and IDs via
client.Reports.GetReportsAsync(_workspaceCollectionName, _workspaceId)
You can retrive the datasets' names and IDs via below snappet in the Case '8' in ProvisionSample.
await ListDatasets(workspaceCollectionName, workspaceId);
Save both above to database tables and Join them on the column datasetName and reportName.
By the way, you will have to use an extra parameter "Overwrite" to avoid duplicated dataset/report names when importing a pbix.
var import = await client.Imports.PostImportWithFileAsync
(workspaceCollectionName, workspaceId, fileStream, datasetName, "Overwrite");